plot the sine wave
Show older comments
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
Answers (0)
Categories
Find more on Discrete Fourier and Cosine Transforms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!