Section 6.1: Fourier series methods for the heat equation Example 6.2: An inhomogeneous example
Consider the IBVP
The constant A has value 0.208 cm2/s.
clear
A=0.208
A =
0.2080
The solution can be written as
where the coefficient an(t) satisfies the IVP
The values c1, c2, c3, ... are the Fourier sine coefficients of the constant function 10-7:
syms n x pi
2/100*int(10^(-7)*sin(n*pi*x/100),x,0,100)
ans =
-(cos(pi*n) - 1)/(5000000*pi*n)
mysubs(ans,n)
ans =
-((-1)^n - 1)/(5000000*pi*n)
c=ans
c =
-((-1)^n - 1)/(5000000*pi*n)
The coefficient an(t) is given by the following formula:
syms t s
int(exp(-A*n^2*pi^2*(t-s)/100^2)*c,s,0,t)
ans =
((-1)^n - 1)/(104*pi^3*n^3*exp((13*pi^2*n^2*t)/625000)) - ((-1)^n - 1)/(104*pi^3*n^3)
a=simplify(ans)
a =
((1/exp((13*pi^2*n^2*t)/625000) - 1)*((-1)^n - 1))/(104*pi^3*n^3)
Next I define the (partial) Fourier series of the solution:
S=symsum(a*sin(n*pi*x/100),n,1,10);
I can now look at some "snapshots" of the solution. For example, I will show the concentration distribution after 10 minutes (600 seconds). Some trial and error may be necessary to determine how many terms in the Fourier series are required for a qualitatively correct solution. (As discussed in the text, this number decreases as t increases.)
S600=subs(S,t,600);
xx=linspace(0,100,201);
plot(xx,subs(S600,x,xx))
The wiggles in the graph suggest that 10 terms is not enough for a correct graph (after 10 minutes, the concentration distribution ought to be quite smooth). Therefore, I will try again with 20 terms:
S=symsum(a*sin(n*pi*x/100),n,1,20);
S600=subs(S,t,600);
plot(xx,subs(S600,x,xx))
Now with 40 terms:
S=symsum(a*sin(n*pi*x/100),n,1,40);
S600=subs(S,t,600);
plot(xx,subs(S600,x,xx))
It appears that 20 terms is enough for a qualitatively correct graph at t=600.
Share with your friends: |