%ece202 matlab example; %plot the Fourier series approximation with a finite number of terms in the summation; A=10; f=500; signal=A/2; t=[0:1e-06:10e-03]; K=50; for n=1:K; signal=signal+(-A/(n*pi))*sin(2*pi*n*f*t); end plot(t,signal); %plot the amplitude and phase spectra; k=[0:20]; Avec=10./((k*pi)+eps); Avec(1)=5; phase=ones(size(k))*90; phase(1)=0; figure; subplot(211); stem(k,abs(Avec)); subplot(212); stem(k,phase);