Professional Documents
Culture Documents
pdepe
c
u
t
xm
m
x
x f s (1)
u
Where m is 0 or a positive integer and c, f , s are functions of x, t , u,
x
p qf 0 (3)
C C
k , 0 x 1 (1)
t x x
C (t 0, x 0) 0
C(t 0, x 0) 1, C(t 0, x 1) 0
c 1
m0
C
f k
x
s0
g 0
pleft C (0) 1
qleft 0
pright C (1)
qright 0
To solve this problem in Matlab using the pdepe function we need to use
the following steps—refer to Solving PDE Problems in Matlab help
Assuming k =1 here
function C0 = expdeic(x)
C0 =0*x;
(note C0 has to be a vector with one value for each node point
The node point locations are stored in x (see below)
x = linspace(0,1,11);
t = linspace(0,2,5);
Note the first line will make 11 node points 0.1 apart at
x = 0, 0.1, 0.2,---0.9, 1
The second line will provide solutions for the pde at times
t= 0, 0.5,1,1.5 and 2
THIS DOES NOT MEAN TIME STEP IS 0.5
m = 0;
sol = pdepe(m,@expde,@expdeic,@expdebc,x,t);
When you look at sol each row will represent the profile of C at the relevant
time step
Here is an m-file code that rund pdepe once all of the functions have been
defined
clear all
x = linspace(0,1,11);
t = linspace(0,.125,5);
m = 0;
sol = pdepe(m,@expde,@expdeic,@expdebc,x,t);
plot(x,sol(5,:,1))
Here our time range has been chosen so that we can compare with our
explicit code in previous hand out