DSPRelated.com
Forums

ploting frequncy information of a sin wave

Started by joshy jose January 23, 2007
hai friends,

i was just trying to use inbuilt function fft(x,n) to find out the
frequency information of a sin wave and tried to plot it

i took
n=0:.003:2
x=a*sin(2*pi*50*n)
yt(x,1024)
stem(y);
--

i could't get any correct wave form , ic peak at 50 hz

how can this be done
i intension is to demonstrate the windowing and taking FFT of long sequencs
signal

regards,
Joshy m. Jose
kerala , India
91-9447976001
Since you are using 'stem' without any time index you should be getting a graph with 2 peaks at some positie value. try to use a frequency index of -fs/2:1/1024:fs/2 - 1 in your stem() function as so

stem(-fs/2:1/1024:fs/2 - 1,y). Incase you are wondering about fs, its equal to 1/Ts where Ts is 0.003. Hope this helps

joshy jose wrote:
hai friends,

i was just trying to use inbuilt function fft(x,n) to find out the frequency information of a sin wave and tried to plot it

i took
n=0:.003:2
x=a*sin(2*pi*50*n)
yt(x,1024)
stem(y);
--

i could't get any correct wave form , ic peak at 50 hz

how can this be done
i intension is to demonstrate the windowing and taking FFT of long sequencs signal

regards,
Joshy m. Jose
kerala , India
91-9447976001

Amit Pathania