Using MATLAB to do spectral analysis for a periodic signal

279 Views Asked by At

As is said, I was asked to do spectral analysis for a periodic signal, i.e. plot the magnitude of its Fourier transform against frequencies. I know that for periodic signals, the spectral is just Fourier coefficients against integer multiple of its basic frequency. My question is how to use MATLAB to calculate the Fourier coefficients? Will fft work or do I have to direct calculate it? I can write down the formula of the signal, which is a piecewise function.