% Math 3150 Fall 2008
%
% Problem 3.3.4
thickLines (3) ; % remove if is not in your system
% space variable
x = linspace (0 ,1) ;
% time variable will take values in this array
nts = 7; % number of times at which to plot string
ts=linspace (0 ,2*pi , nts ) ;
cols = hsv( nts ) ; % colors with which to plot string
figure (1) ;
clf ;
hold on ;
for
it =1:length( ts ) , % for every time
t = ts ( it ) ;
% we don't need to loop over the number of terms
% the sum has only a few terms
s = sin (pi*x)*cos(pi*t ) + (1/2)*sin (3*pi*x)*cos
(3*pi*t ) + 3*sin (7*pi*x)*cos(7*pi*t ) + (1/2/
pi)*sin (2*pi*x)*cos(2*pi*t ) ;
h=plot(x , s ) ; % plot the partial sum
set (h, ' color ' , cols ( it , : ) ) ;
% adjust axis so that all plots are on the same scale
axis ([0 1 -5 5]) ;
%pause ;
end;
hold off ;
filename='p3_3_4.eps' ;
print( '-depsc2' , filename ) ;
system ([ 'epstopdf ' , filename ]) ;

