## Script that simulates a traveling wave on an ideal string.

dx=1e-2;    ## Spatial increment [m]
c=300;      ## Speed of sound [m/sec]
dt=dx/c;    ## Time increment [sec]
r=c*dt/dx;  ## Dimensionless constant

x=-1:dx:1;
l=length(x);
x0=0.5;
k=1e2;
## Set up the initial profile 
y=initial_profile(x,x0,k);
plot(x,y)
pause

## Impose the time boundary condition
ynow=y;
yprev=y;

Nsteps=2000;

for n=1:Nsteps
  
  ynext=propagate(ynow,yprev,r);
  plot(x,ynext,';;')
  axis([-1.05,1.05,-1.1,1.1])
  pause(0);

  yprev=ynow;
  ynow=ynext;

endfor
