Trinh @ Bath

Lecture 26: Computation of the wave equation II

Theorem 16.3 (Solution of the zero-Dirichlet wave equation)

At the start of the lecture, we continue deriving the Fourier coefficients for the problem of zero Dirichlet conditions on the wave equation. We show that

u(x,t)=n=0sin(nπxL)[Ancos(nπctL)+Bnsin(nπctL)]

where An=2L0Lu0(x)sin(nπxL) dx.

and Again we recognise this as the sine series, so we now need to equate Bn=2L(Lnπc)0Lv0(x)sin(nπxL) dx.

Example 16.4: Plucked string

The next thing we did was look at the solution for the plucked string of example 16.4 in the notes. This yields the above Fourier series solution with Bn=0 and An=4n2πsin(nπ/2).

We showed off the simulations of the problem using the following code.

Plucked string

  1. % MA20223 Plucked String
  2. clear
  3. close all
  4.  
  5. % c = 1
  6.  
  7. x = linspace(0, pi, 100);
  8. t = linspace(0, 2*(2*pi), 80);
  9. Afunc = @(k) 4*(-1)^k/((2*k+1)^2*pi);
  10. un = @(x, t, k) Afunc(k)*sin((2*k+1)*x).*cos((2*k+1)*t);
  11.  
  12. Nk = 80;
  13. figure(1)
  14. for j = 1:length(t)
  15. tt = t(j);
  16. u = 0;
  17. for k = 0:Nk
  18. u = u + un(x,tt,k);
  19. end
  20. plot(x, u);
  21. ylim([-pi/2, pi/2]);
  22. drawnow
  23. if j == 1
  24. pause;
  25. else
  26. pause(0.1)
  27. end
  28. end