% % w03exp.m % % initialize workspace & set some control variables clear; Nt = 50; % number of terms Np = 16*Nt; % number of plot points % set x (row) vector (type "x" at the >>) dx = pi/Np; x = -pi:dx:pi; % choose figure & clear (type "help hold") figure(1); clf % compute series yf = 0; for j = 1:Nt yf = yf + exp(i*j*x)/j; end subplot(2,1,1) plot(x,real(yf),'b') % !!! put some info on the plot !!! title('\bf problem 3B') xlabel('\bf x-axis') ylabel('\bf Re( F_N(x) )') %axis([-pi pi 0 5]) subplot(2,1,2) plot(x,imag(yf),'r') xlabel('\bf x-axis') ylabel('\bf Im( F_N(x) )') %axis([-pi pi -2 2])