This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
vpde_lecture25 [2020/03/31 08:25] trinh |
vpde_lecture25 [2020/04/04 21:33] (current) trinh |
||
---|---|---|---|
Line 2: | Line 2: | ||
This lecture will do apply separation of variables and Fourier series in order to solve for the wave equation on a finite interval. | This lecture will do apply separation of variables and Fourier series in order to solve for the wave equation on a finite interval. | ||
+ | |||
+ | < | ||
+ | <iframe width=" | ||
+ | </ | ||
===== Definition 16.1 (1D wave equation with homogeneous Dirichlet BCs ===== | ===== Definition 16.1 (1D wave equation with homogeneous Dirichlet BCs ===== | ||
Line 35: | Line 39: | ||
===== Example 16.2 (Imagining the modes) ===== | ===== Example 16.2 (Imagining the modes) ===== | ||
- | I want to help you imagine what the modes, $u_n$, look like. For simplicity, take the length $L = \pi$. Also, we may take $c = 1$. | + | I want to help you imagine what the modes, $u_n$, look like. For simplicity, take the length $L = \pi$. Also, we may take $c = 1$. The individual modes we want to examine are: |
+ | $$ | ||
+ | u_n(x, t) = \sin\left(nx\right) \left[ A_n \cos(nct) + B_n \sin(nct)\right] | ||
+ | $$ | ||
+ | |||
+ | < | ||
+ | % Code for MA20223 30 Mar 2020 | ||
+ | clear | ||
+ | close all | ||
+ | |||
+ | % Length and time | ||
+ | L = pi; T = 2*pi/ | ||
+ | |||
+ | % Function | ||
+ | n = 2; c = 1; | ||
+ | un = @(x,t) sin(n*x/ | ||
+ | |||
+ | % Make vectors for space and time | ||
+ | x = linspace(0, pi, 50); t = linspace(0, 2*T, 50); | ||
+ | |||
+ | % Create a mesh of x vs. t | ||
+ | [X,T] = meshgrid(x, | ||
+ | |||
+ | % Matrix of U values to imagine the surface | ||
+ | U = sin(n*X).*cos(n*T); | ||
+ | |||
+ | figure(1); subplot(1, | ||
+ | |||
+ | subplot(1, | ||
+ | % Plot the surface and make it pretty | ||
+ | s = surf(X, | ||
+ | view([-48, 17]); xlabel(' | ||
+ | hold on | ||
+ | |||
+ | % Plot an animation in time | ||
+ | for j = 1: | ||
+ | tt = t(j); uu = un(x,tt); | ||
+ | |||
+ | subplot(1, | ||
+ | plot(x, uu); | ||
+ | ylim([-1, | ||
+ | |||
+ | subplot(1, | ||
+ | if j == 1 | ||
+ | p = plot3(x, tt*ones(size(x)), | ||
+ | pause; | ||
+ | else | ||
+ | set(p, ' | ||
+ | end | ||
+ | |||
+ | drawnow | ||
+ | shg | ||
+ | end | ||
+ | </ | ||
+ | |||
+ | ==== Implementation of the Fourier series ==== | ||
+ | |||
+ | Now we need to look to solve for the coefficients of our series by applying the boundary conditions. We have 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] | ||
+ | $$ | ||
+ | |||
+ | Imposing the initial displacement, | ||
+ | $$ | ||
+ | u_0(x) = \sum_{n=0}^\infty A_n \sin\left(\frac{n\pi x}{L}\right), | ||
+ | $$ | ||
+ | |||
+ | which we recognise as the sine series for the odd $2L$-periodic extension of the function $u_0(x)$ originally defined on $[0, L]$. So the coefficients are (see theorem 12.7) | ||
+ | $$ | ||
+ | A_n = \frac{2}{L} \int_0^L u_0(x) \sin\left(\frac{n\pi x}{L}\right). | ||
+ | $$ | ||
+ | |||
+ | Imposing the initial velocity, we have | ||
+ | $$ | ||
+ | v_0(x) = \sum_{n=1}^\infty \left(\frac{n\pi c}{L}\right)B_n \sin\left(\frac{n\pi x}{L}\right) | ||
+ | $$ | ||
+ | |||
+ | Again we recognise this as the sine series, so we now need to equate | ||
+ | $$ | ||
+ | \left(\frac{n\pi c}{L}\right)B_n = \frac{2}{L} \int_0^L v_0(x) \sin\left(\frac{n\pi x}{L}\right). | ||
+ | $$ | ||
+ | |||
+ | //(The video gets very close to the end of this; we managed to get the $A_n$ coefficients and need to address the $B_n$ coefficients in lecture 26)// |