Need to Decrease the Width of FFT
조회 수: 7 (최근 30일)
이전 댓글 표시
Hi
I'm quite new to MATLAB. I'm working on spectral analysis of a signal and trying to obtain its FFT. But the problem is that my spectral lines are coming out to be quite braod and eventually, data analysis is not possible. I'm using the following code for the obtaining the FFT:
M = 2.5e-4; Fs = 1/M; T = 1/Fs; L=1000000; NFFT = 2^nextpow2(L); Y = fft(ias, NFFT)/L; f = Fs/2*linspace(0,1,NFFT/2+1); plot(f,2*abs(Y(1:NFFT/2+1)))
Kindly suggest some solution for this problem.
Thanks and Regards.
댓글 수: 0
답변 (3개)
Rick Rosson
2011년 7월 1일
Please try the following code. To increase the resolution of the Fourier spectrum, increase the value of the parameter k (and vice versa):
% Up-Sampling factor:
k = 4;
[M,N] = size(ias);
% Zero pad the signal:
ias = [ias ; zeros((k-1)*M,N) ];
M = k*M;
% Time domain:
dt = 2.5e-4;
t = dt*(0:M-1)';
% Frequency domain:
Fs = 1/dt;
dF = Fs/M;
f = (-Fs/2:dF:Fs/2-dF)';
% Discrete Fourier Transform:
Y = fftshift(fft(ias))/M;
% Plot the spectrum:
figure;
plot(f,abs(Y));
HTH.
Christos Saragiotis
2011년 7월 2일
Dear Chirag,
From what you say, I understand that you want to decrease the df of your spectrum. You know that df = 1/(N dt), where N is the number of your samples and dt = 1/fs is the sampling interval. Therefore, df = 1/T where T = N dt is the total time of observation.
So in order to make df finer, you need to increase the time of recording, T.
When you just zero-pad (as when you take the 2^nextpow2), your figure will have a finer df but in fact the resolution hasn't increased. fft just "interpolates" the values.
Regards,
Christos
Rick Rosson
2011년 7월 1일
Hi Chirag,
If you know that the input signal is a pure-tone sine wave at 50 Hz, then you can simply generate the signal to any length that you want. The more samples you add to the sine wave, the narrower will be the resulting spectral line.
Please try the following:
% Up-Sampling factor:
k = 4;
[M,N] = size(ias);
M = k*M;
% Time domain:
dt = 2.5e-4;
t = dt*(0:M-1)';
% Generate pure tone sine wave:
A = 1;
Fc = 50;
ias = A*cos(2*pi*Fc*t);
% Frequency domain:
Fs = 1/dt;
dF = Fs/M;
f = (-Fs/2:dF:Fs/2-dF)';
% Discrete Fourier Transform:
Y = fftshift(fft(ias))/M;
% Plot the spectrum:
figure;
plot(f,abs(Y));
HTH.
Rick
참고 항목
카테고리
Help Center 및 File Exchange에서 Spectral Measurements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!