calculate frequency band using Parseval

조회 수: 14 (최근 30일)
biomed
biomed 2011년 9월 28일
댓글: Sk Group 2021년 2월 8일
I have the fft of my signal, but I don't know its frequency band and there are no lobe to extimate it.
Can I use Parseval's Theorem to calculate the band?
Could anyone post the code?

채택된 답변

Wayne King
Wayne King 2011년 9월 28일
Hi, You can determine what percentage of power lies within a certain band. Here I determine the frequency with maximum power and then find the percentage of power lying in a band that is the maximum frequency plus or minus 2 DFT bins
Fs = 1e3;
t = 0:1/Fs:1-(1/Fs);
x = cos(2*pi*100*t)+randn(size(t));
psdest = psd(spectrum.periodogram,x,'Fs',1e3,'NFFT',length(x));
[mx,I] = max(psdest.Data);
relperc = ...
100*avgpower(psdest,[psdest.Frequencies(I-2) psdest.Frequencies(I+2)])/avgpower(psdest,[0 Fs/2])
Or you could use cumsum() to get the cumulative percent power and figure out the power in a band with the appropriate subtraction.
xdft = fft(x);
xdft = xdft(1:length(x)/2+1);
relpower = 100*cumsum(abs(xdft).^2)/norm(xdft,2)^2;
plot(relpower);
The following gives you the percentage power at 100 Hz plus or minus two DFT bins.
relpower(103)-relpower(99)
Note it's very close to the answer returned by the first method.

추가 답변 (1개)

Wayne King
Wayne King 2011년 9월 28일
Hi, If you have the DFT (discrete Fourier transform) as implemented by fft(), then you have the frequencies. The frequencies are of the form (Fs*k)/N where Fs is the sampling frequency, N is the length of the signal and k runs from 0,1,...N/2 (for N even)
Parseval's theorem just demonstrates that energy is conserved.
x = randn(1e3,1);
xdft = fft(x);
norm(x,2)
(1/sqrt(length(x)))*norm(xdft,2)
  댓글 수: 2
Wayne King
Wayne King 2011년 9월 28일
I should note that the DFT is periodic with period N so the other half of the frequencies can be thought of as the negative version of the above, or you can just let k run from 0,..... N-1
biomed
biomed 2011년 9월 28일
Hi, I read that using Pareseval's theorem it'ss possible to calculate the width of the band when the signal has, for example, 90% of its energy.
So if the band is [-W,W], the integral between -W and W of (|X(f)|^2)df is equal to 0.9*total_energy of the signal
What should I write in the code to find the width band 2W?

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by