Commit 08c59b35 authored by thomas.forbriger's avatar thomas.forbriger
Browse files

libpsdxx [FEATURE]: provide mapping of linear frequency scale to logarithmic

parent e7696174
......@@ -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 ----- */
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment