Skip to main content

SINUSOIDALY DRIVEN STRING


## Takes in the previous and the present profiles of the string and
## iterates to find the profile in the next time step.
function ynext=propagate_driven(ynow,yprev,r,omega,A,n,dt)
## initialization, boundary condition
ynext=ynow;
## takes in length(ynow) as an argument
## since one end of the string is driven sinuosidaly
## omega is the angular frequency of the driven force
## n is the time index, n*dt is t(n)
ynext(length(ynow))=A*sin(omega*n*dt);
## entering the loop
for i=2:length(ynow)-1
ynext(i) = 2*(1-r^2)*ynow(i)-yprev(i)+r^2*(ynow(i+1)+ynow(i-1));
endfor
endfunction

Comments

Popular posts from this blog