DSPRelated.com
Forums

Re: FFT Frequency plot

Started by hide...@yahoo.com July 26, 2008
maybe you can try this one. this is M-file ONLY to show how to develop sinusoidal signal with some modulation & show it in frequency domain.

hope this will help you
Nf = 800; %choose number of frequency data
fs = 256; %choose sampling frequency
Nt = Nf*2.56; %compute number of time dom. data
T = 0:(1/fs):(Nt/fs); %time range
x = 1*sin(2*pi*30*T)+1*sin(2*pi*100*T); %function
subplot(211);
plot(T,x)
y = fft(x,Nt); %compute FFT
mag =(2*abs(y))/Nt; %compute magnitude
freq = (0:(Nt/2))*(fs/Nt); %compute discrete freq. range
subplot(212);
plot(freq,mag(1:((Nt/2)+1))) %plot in all discrete frequency