Docsity

Continuous Time Fourier Series, Exercises of Digital Signal Processing

Partial preview of the text

Download Continuous Time Fourier Series and more Exercises Digital Signal Processing in PDF only on Docsity!

% trucated Fourier series for a staircase signalT = 4;w0 = 2pi/T;t = 0:T/1000:3T;

N = input(’input N’)nneg = -N:-1;npos = 1:N;c0 = 3/4;

cneg = 1/j/pi./nneg.(1-.5(-1).^nneg-.5exp(-jnnegpi/2));cpos = 1/j/pi./npos.(1-.5(-1).^npos-.5exp(-jnpospi/2));n = [nneg 0 npos];c_n = [cneg c0 cpos];

x = c_nexp(jw0n’t);x = real(x);plot(t,x)xlabel(’Time (sec)’) % strips off negligible imaginary parts

title([’x’,num2str(N),’(t)’]) The truncated series is plotted from top to bottom for N = 3, N = 10, and N = 40.

-2^00 2 4 6 8 10

Time (sec)

x 3 (t)

-2^00 2 4 6 8 10

Time (sec)

x 1 0(t)

-2^00 2 4 6 8 10

Time (sec)

x 4 0(t)