Write a computer program to evaluate the coefficients of the complex exponential Fourier series of a signal by using the FFT.
Check it by evaluating the Fourier series coefficients of a square-wave and comparing your results with Computer Exercise 2.2.
Exercise 2.2
Generalize the computer program of Computer Example 2.1 to evaluate the coefficients of the complex exponential Fourier series of several signals. Include a plot of the amplitude and phase spectrum of the signal for which the Fourier series coefficients are evaluated. Check by evaluating the Fourier series coefficients of a square wave. Plot the square-wave approximation by summing the series through the seventh harmonic.
Example 2.1