Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Seitosh
Seitosh
Commits
08c59b35
Commit
08c59b35
authored
Feb 14, 2019
by
thomas.forbriger
Browse files
libpsdxx [FEATURE]: provide mapping of linear frequency scale to logarithmic
parent
e7696174
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/libs/libpsdxx/function_log_frequency.cc
View file @
08c59b35
...
...
@@ -121,6 +121,22 @@ namespace psd {
// const unsigned int& nsamples,
// const unsigned int& n_per_decade)
/* ---------------------------------------------------------------------- */
TDseries
log_frequency
(
const
TDseries
::
Tcoc
&
flin
,
const
unsigned
int
&
n_per_decade
)
{
// consistency checks
PSDXX_assert
(
flin
.
size
()
>
1
,
"input series must contain at least 2 values"
);
double
df1
=
flin
(
flin
.
f
()
+
1
)
-
flin
(
flin
.
f
());
double
df2
=
flin
(
flin
.
l
())
-
flin
(
flin
.
l
()
-
1
);
PSDXX_assert
(
std
::
abs
((
df2
/
df1
)
-
1.
)
<
1.e-8
,
"input frequency scale is not linear"
);
return
(
log_frequency
(
df1
,
flin
.
size
(),
n_per_decade
));
}
// TDseries log_frequency(const TDseries::Tcoc& lin_frequency,
// const unsigned int& n_per_decade)
}
// namespace psd
/* ----- END OF function_log_frequency.cc ----- */
src/libs/libpsdxx/psd.h
View file @
08c59b35
...
...
@@ -268,6 +268,21 @@ namespace psd {
const
unsigned
int
&
nsamples
,
const
unsigned
int
&
n_per_decade
);
/*! \brief return a logarithmic frequency scale
*
* \param lin_frequency series of frequency values on linear scale
* \param n_per_decade number of samples per frequency decade
* for logarithmic sampling
* \return series of frequency values in Hz with logarithmic spacing and
* \p n_per_decade frequency values per decade
*
* This function is used to compute a series of frequency values with
* logarithmic spacing. The return value can be used as input parameter to
* the actual sampling functions.
*/
TDseries
log_frequency
(
const
TDseries
::
Tcoc
&
lin_frequency
,
const
unsigned
int
&
n_per_decade
);
/*! sample complex values on a logarithmic frequency axis
*
* \param s spectral values with uniform sampling along frequency axis
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment