plot the sine wave

I need to plot x(n)=cos(3*pi*n/4) for values of n=0:255
Also compute and plot the 256-point DFT using (fft) and only display the first 128 DFT coefficients. I am not provided with any more information regarding sampling frequency or time version of signal. I am able to plot it however, the plot I get does not give me a smooth sinusoidal wave. I'm not sure if I'm doing it correct. Can someone aid me in the right direction please? here is my code:
N=256;
>> n=0:255;
>> x=cos(3*pi*n/4);
>> figure(1)
>> plot(n,x)
>> X=abs(fft(x,N))
>> plot(X)
>> axis([0,128,0,140])
Do I have to find out what the sampling frequency is and convert this digital signal into its time representation? Thanks again.
Christian

回答 (0 件)

タグ

質問済み:

2014 年 4 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by