function [] = onewaywaveStability()
M = 500;
h = 10/500;
x = linspace(0,10, M+1);
N = 500;
k = h;
u = zeros(N+1, M+1);
u(1, 1:51) = 1-cos(2*pi*x(1:51));
for n=2:(N+1)
u(n, 1:M) = -u(n-1, 2:(M+1)) + 2*u(n-1, 1:M);
u(n, M+1) = u(n, 1);
end
figure(1); clf;
F(50) = struct('cdata',[],'colormap',[]);
for l = 1:50
plot(x, u(1+10*l,:));
drawnow;
F(l) = getframe;
end
movie(F);
for n=2:(N+1)
u(n, 2:(M+1)) = u(n-1, 1:M);
u(n, 1) = u(n, M+1);
end
figure(2); clf;
for l = 1:50
plot(x, u(1+10*l,:));
drawnow;
F(l) = getframe;
end
movie(F);
end