how I can analyze this magnitude of 1D signal
6 views (last 30 days)
Show older comments
This is a DFT magnitude graph of a set of 1D points. How can I analyze it? Can I say that the lowest frequency contribute most or the 0 frequency contribute most? It is not 0 frequency, isn't it? The 0 frequency is DC component before getting magnitude with abs(fft(s1)).
0 Comments
Accepted Answer
Wayne King
on 4 Nov 2013
If the large value shown in the figure corresponds to 0 frequency, then that simply means the signal has a nonzero DC value. The 0 frequency component in the DFT is simply the sum of all elements in the input signal, or N times the mean value of the signal, where N is the number of elements in the signal.
Quite often, the zero frequency component is not of interest when doing a frequency analysis. To remove that, simply remove the mean from the signal.
For example, compare:
Fs = 1000;
t = 0:1/Fs:1-1/Fs;
x = 20+cos(2*pi*100*t)+randn(size(t));
xdft = fft(x);
xdft = xdft(1:length(x)/2+1);
plot(abs(xdft))
% remove mean
xnew = x-mean(x);
xdftnew = fft(xnew);
xdftnew = xdftnew(1:length(x)/2+1);
plot(abs(xdftnew))
3 Comments
Wayne King
on 4 Nov 2013
Yes, I would say so, because you don't need to have the DFT to know what the zero frequency component is, sum(x) will give you that information.
More Answers (1)
Wayne King
on 5 Nov 2013
Edited: Wayne King
on 5 Nov 2013
You have a real-valued signal, so you only need 1/2 your magnitudes. I can't tell from your graph if your signal has even length or odd length. I'll assume length 52
Each frequency bin has spacing Fs/N Hz where N is the length of the signal and Fs is the sampling frequency. If you are just using normalized frequency, then the spacing is (2*pi)/N radians/sample.
n = 0:51;
x = cos((2*pi)/13*n);
xdft = fft(x);
xdft = xdft(1:length(x)/2+1);
stem(abs(xdft))
The sine wave has a frequency of (2*pi)/13 radians/sample. The spacing of the "bins" in the DFT is (2*pi)/52 radians/sample. Because the first bin xdft(1) corresponds to zero frequency, you expect the frequency of (2*pi)/13 radians/sample to fall on xdft(5), which it does.
See Also
Categories
Find more on Digital Filter Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!