필터 지우기
필터 지우기

Need to Decrease the Width of FFT

조회 수: 7 (최근 30일)
Chirag
Chirag 2011년 6월 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.

답변 (3개)

Rick Rosson
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.
  댓글 수: 2
Chirag
Chirag 2011년 7월 1일
Thanks a lot for the answer.
I tried the code. But it didn't work. There is no change in the width. I varied the value of M from 4 to 4000.
I think the problem is with the data points. Is there anyway I can increase the number of data points in my code. For the sake of simplicity, I'm taking the FFT of a sin wave with freq of 50 HZ, but the spectral line is from 48.5 to 51.5 Hz. It might be due to less number of data points being fed to FFT function.
Thanks a lot again.
Chirag
Chirag 2011년 7월 1일
I think if i'm able to increase the data points, problem will be solved. Please let me know if there is any way to do so.
Thanks.

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


Christos Saragiotis
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
  댓글 수: 2
Rick Rosson
Rick Rosson 2011년 7월 2일
Yes, that is correct.
Chirag
Chirag 2011년 7월 4일
Thank you for your reply. I tried the method you suggested, but unfortunately it didn't work.
Kindly, go through the link to have a better look at my problem:
https://docs.google.com/leaf?id=0B4dPcFFHHl9VZGM3ZmJiMWItYzAyMy00YjAxLWFhOWUtYTA3YjRiNTI3ODE4&hl=en_US
Thanks and regards.

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


Rick Rosson
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
  댓글 수: 1
Chirag
Chirag 2011년 7월 4일
Thank you for your reply. I tried the method you suggested, but unfortunately it didn't work.
Kindly, go through the link to have a better look at my problem:
https://docs.google.com/leaf?id=0B4dPcFFHHl9VZGM3ZmJiMWItYzAyMy00YjAxLWFhOWUtYTA3YjRiNTI3ODE4&hl=en_US
Thanks and regards.

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

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by