0
$\begingroup$

When I plot said function output, "p," it looks like a typical spectrum with an easily identifiable peak at a given ix on the x axis. The help rubric from the function is

SYNTAX: p = mesa(x,m,nfreq);
For a vector x, this function calculates a maximum-entropy spectrum
of order m. The spectral estimate is returned in the vector p, which
has nfreq points linearly spaced in the Nyquist frequency interval 0-.5.
The psd is normalized such that the mean square value of x equals the
integral of p from -.5 to .5, so sum(x.^2)/N ~= sum(p)/nfreq.
Mesa is based on the Burg algorithm, as described in Numerical Recipes
and implemented in their memcof and evlmem subroutines.

Written by Eric Breitenberger        Version 5/24/95

My problem is that the x axis is unitless, i.e. if nfreq = 200 then the x axis is 1 to 200 long. If the peak is at x axis ix = 22, for example, how do I calculate the measured frequency/period of the input signal "x"?

To give a concrete example:

the length of the input vector "x" is 20 because I believe (or know due to a controlled input experiment) this length vector contains one full cycle (noisy sinusoidal) of interest

order m is set to 10, for example, although this is incidental to my question as I can see from experiment that changing the value of m only affects the sharpness of the peak

nfreq is set to 200

and with these values the peak occurs at x axis ix == 22.

From this, what is the mathematics to get the measured frequency/period from the output of the function?

Plot of the output enter image description here for a known input, e.g.

input_x = awgn( sinewave( 20 , 20 ) , 10 ) ;
$\endgroup$
1
$\begingroup$

From the code on p.$7$ of this document it can be seen that the $N$ (nfreq in the code) frequency points are chosen equidistantly between zero and Nyquist (i.e., $f_s/2$, with $f_s$ being the sampling frequency) using the command linspace(). So the individual frequencies are given by

$$f_k=\frac{kf_s}{2(N-1)},\qquad k=0,1,\ldots, N-1\tag{1}$$

[Note that the indices $k$ in $(1)$ start at zero.]

|improve this answer|||||
$\endgroup$
  • $\begingroup$ For my given example, what would the sampling frequency be? 1/20 = 0.05? $\endgroup$ – babelproofreader Aug 25 '19 at 18:04
  • $\begingroup$ @babelproofreader: You need to know what the sampling frequency of your input signal is, I can't know. You provide data x to the function, and you need to know what the time between samples is. If there is no actual sampling going on, you can just define $f_s=1$, and your sine wave then has a frequency of $f_s/20=1/20$. $\endgroup$ – Matt L. Aug 25 '19 at 19:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.