1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| function c= pdepetrans
clear all
clc
clf
M=100;
N=100;
D=[0.1,0.115,0.2];
t=linspace(0,1,100);
x=linspace(0.1,1,100);
options=odeset('RelTol',1e-4,'AbsTol',1e-4,'NormControl','off','InitialStep',1e-7);
c=pdepe(0,@transfun,@ictransfun,@bctransfun,x,...
[ t], options,D);
plot ( x, c( : ,: ))
function [c,f,s]=transfun(x,t,u,DUDX,D)
c=1;
f=D*DUDX;
s=0;
function u0=ictransfun(x,c,D)
u0=sin(pi*x);
function [pl,ql,pr,qr]=bctransfun(xl,ul,xr,ur,t,D)
pl=ul-0;
ql=0;
pr=ur-0;
qr=0; |
Partager