how to plot frequecy spectrum of fft ?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
i am learning fft in matlab . i am trying to plot frequency response of fft of rectangular pulse in matlab. my function is x(t)=1 , -1/2<t<1/2 i found the fft of function but i am trying to plot fft frequency plot of this function and not getting
0 comentarios
Respuestas (3)
Youssef Khmou
el 10 de Mzo. de 2013
hi,
To efficiently use FFT, you need to know the sampling frequency of your signal
So you can proceed like the following : 1) You construct your rectangular pulse :
Fs=100; % Sampling frequency
t=-1:1/Fs:1;
y=zeros(size(t));
% Rectangular pulse
for n=1:length(t)
if t(n)>-0.5 && t(n)<0.5
y(n)=1;
end
end
plot(t,y)
axis([-1 1 -1 2])
grid on,
2) You compute the spectrum, the instructions here are available for any given signal :
% Discrete Fourier Transform
L=length(y);
N=ceil(log2(L));
fy=fft(y,2^N)/(L/2);
f=(Fs/2^N)*(0:2^(N-1)-1);
figure, plot(f,abs(fy(1:2^(N-1))));
Theoretically, you have to know what to expect : Take a look at this page : http://demonstrations.wolfram.com/RectangularPulseAndItsFourierTransform/
Let us try to see if the numeric result matches the theory :
G=sinc(pi*f);
figure, plot(f,G);
Does it look the same ?
0 comentarios
Azzi Abdelmalek
el 10 de Mzo. de 2013
t=-1:0.01:1
y=zeros(1,numel(t))
y(abs(t)<1/2)=1
Y=fft(y)
stem(abs(Y))
0 comentarios
Ketan Dewan
el 28 de Sept. de 2016
I have a question regarding the sampling clok for the FFT.
I am using a clock which is made of 100 samples. Should I use for the FFT the aboslute clock freqeuncy or 100* clock frequency ?
0 comentarios
Ver también
Categorías
Más información sobre Spectral Measurements en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!