figure(1); clf;


x = linspace(0, pi, 200);

n = 3;
a = 1;

for i=1:200
  t = 0.05*i;
  u = sin(a*n*t).*sin(n*x);
  % or you could look at a "superposition" of two waves:
  %u = sin(a*2*t).*sin(2*x) + 0.25*sin(a*5*t).*sin(5*x);

  clf;
  plot(x, u, 'linewidth', 3);
  ylim([-1.02 1.02])
  xlim([0 pi])
  xlabel('x');
  ylabel('u');
  shg
end
