%   ondes01.m
%   fd, 13 decembre 2010, 06 mars 2025  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   clear ; format long

fprintf('ondes 01\n') ; 
fprintf('equation des ondes avec les series de Fourier \n') 
fprintf('un seul mode \n')


n = 180  


niter = 180 %% 60 %% 180 

dx = 1/n ; 

xx = zeros(1,n+1) ; y1 = xx ; 
xa    = 0 ; 
for j = 1:n+1 ; xx(j) = xa ; y1(j) = sin(pi*xa) ; 
xa = xa + dx ; end 


plot (xx,y1,'k;;' )
axis ([ -.02 , 1.02 , -1.05 , 1.05]) 
delete (findobj ("tag", "legend"))
title ('condition initiale : fonction sinus') ;
print('01a-sinus-initial', '-djpg','-S891,630'); 
pause (1) 

sigma = 2
dt    = sigma * dx ; 




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

hold off
t     = 0   ; 
for jtime = 1 : niter  
for j = 1:n+1 ; 
yy(j)    =  cos(pi*t) * y1(j) ; end 
t     = t + dt ; 
plot ( xx,y1,'k;inf;' ,   xx,yy,'b;t;' )
delete (findobj ("tag", "legend")) 
axis ([ -.02 , 1.02 , -1.05 , 1.05])
title ('premier mode de vibration d une corde') ;


if jtime==60 ; 
print('01b-sinus-en-evolution' , '-djpg','-S891,630'); 
%%% print('01c-sinus-en-evolution' , '-djpg','-S891,630'); 
end ; 

pause (.001) ; end 

 

