P.H. Trinh

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) = \sum_{n=0}^\infty \sin\left(\frac{n\pi x}{L}\right) \left[ A_n \cos\left(\frac{n\pi ct}{L}\right) + B_n \sin\left(\frac{n\pi ct}{L}\right)\right] $$

where $$ A_n = \frac{2}{L} \int_0^L u_0(x) \sin\left(\frac{n\pi x}{L}\right) \ \mathrm{d}{x}. $$

and Again we recognise this as the sine series, so we now need to equate $$ B_n = \frac{2}{L} \left(\frac{L}{n\pi c}\right)\int_0^L v_0(x) \sin\left(\frac{n\pi x}{L}\right) \ \mathrm{d}{x}. $$

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 $B_n = 0$ and $$ A_n = \frac{4}{n^2\pi} \sin(n\pi/2). $$

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

Plucked string

% MA20223 Plucked String
clear
close all

% c = 1

x = linspace(0, pi, 100);
t = linspace(0, 2*(2*pi), 80);
Afunc = @(k) 4*(-1)^k/((2*k+1)^2*pi);
un = @(x, t, k) Afunc(k)*sin((2*k+1)*x).*cos((2*k+1)*t);

Nk = 80;
figure(1)
for j = 1:length(t)
    tt = t(j);
    u = 0;
    for k = 0:Nk
        u = u + un(x,tt,k);        
    end
    plot(x, u); 
    ylim([-pi/2, pi/2]);
    drawnow
    if j == 1
        pause;
    else
        pause(0.1)
    end
end