fft Amplitude Spectrum Stem Plot from Fourier Series

8 views (last 30 days)
I want to make a stem plot (amplitude spectrum using stem()) from the fft function in MATLAB, given the Fourier Series function I derived. Is this possible using just the function or do I need to evaluate the function into a txt file and use those numbers to do it (aka read in the file)?
Here is the series I want to analyze:
y(t) = (-10/pi)*Sum_n=1->inf [cos(pi*n)/n * sin(pi*n*t/5]
I know that there are formulas for finding the amplitude spectrum based on coefficients of the series function, but I'm stuck in the interpretation to get them into MATLAB. Is stem() the equivalent of the amplitude spectrum? That's what my prof. used in his code, but, again, his code is based off reading in data from a file. I want to take the function and directly apply it without reading in a file of data.
Thanks in advance!

Accepted Answer

Geoff Hayes
Geoff Hayes on 14 Feb 2015
Quizmaster - you don't have to read data from a text file in order to use the stem function. It is a visual tool only that is used to plot a discrete sequence of data. I've used it to plot the discretized data that had been sampled from a continuous signal (prior to performing an FFT). A similar question was asked at http://www.mathworks.com/matlabcentral/answers/24116-stem-function-and-fft and includes some code for using stem with the output from an FFT.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!