I am using Matlab R2012b 64-bit on Windows 7 in order to estimate the power
spectrum of a simple signal that is:
cos(10*t) + sin(20*t) defined in the time interval from 0.0 to 10.0
Here is what I did:
1) There was no predefined value of points so I took 1001 points by forming a
time array and sampled the function at these points.
2) I calculated the autocorrelation function of the signal with the built-in
3) I performed FFT directly on the autocorrelation function with no additional
4) The resulting data set had imaginary parts(I think this should not be the
case since the autocorrelation function is even).
5) I took the absolute value of the FFT of ACF and plotted it as the power
spectrum from the ACF after having it shifted with fftshift.
6) I took the FFT of the sinusoidal signal after padding it with 1000 (n-1)
7) I calculated the power spectrum from the FFT of the signal as the square of
the absolute value of the frequency coefficients.
8) I plotted both of them and compared them by assigning an array to difference
9) They turned out to be the same.
Everything seems to be working correctly but my concerns are as follows:
- How can this data be interpreted? I expected the sum and difference
frequencies of the individual sinusoidal functions in the signal.
-How can I normalize the output and represent negative frequencies properly
since they have no physical significance?
-Does Matlab use FFTW libraries? My main task is to achieve the same results in
a C program using these libraries.
I have benefitted from the following URL:
in organizing the post and achieving these results.
I would be grateful for an explanation of this phenomenon and normalization
Thanks in advance
P.S : The code snippet I have used is as follows and it can reproduce my
title('PS from FFT');
title('PS from ACF');
fprintf('Max error = %6.2f \n', max(abs(d)));
Matlab obtaining power spectrum from ACF and FFT
Started by ●May 19, 2014