i don't find the error

조회 수: 2 (최근 30일)
mouna
mouna 2011년 5월 11일
i have this system:
dC/dt+(u/epsilon)*dC/dz-Dl*(d^2 C)/(dz^2 )+((1-epsilon)/epsilon)*(rhos/rhof)*dq/dt=0 ;
dq/dt=K*a*(q-Keq*C )
the initial and boundary conditions are:
t=0, C=C0, z>0
t=0, q=q0, z>0
z=0, (u/epsilon)* C-Dl*dC/dz=0, t>0
z=L, dC/dz=0, et dq/dz=0 ;t>0
i wrote this algorithm but i have an error that i don't find it:
function vasco
m=0;
z=linspace(0,30);
t=[ 0 50 100 150 200];
sol = pdepe(m,@pdexpde,@pdexic,@pdexbc,z,t);
C = sol(:,:,1);
q = sol(:,:,2);
function [g,f,s]= pdexpde(z,t,C,DCDz)
rhos=0.55;
rhof=0.385;
dp=0.03;
a=6/dp;
epsilon=0.45;
Ki=1.4E-7;
u=0.098;
Dl=4.7E-5;
keq=16.86;
A=Ki*a*(C(2)-(keq*C(1)));
B=((1-epsilon)/epsilon)*(rhos/rhof)*A;
g=[1; 1];
f=[Dl.*DCDz; 0];
s=[((-u)/epsilon).*DCDz-B; A];
function u0 = pdexic(z)
c0=0.0015;
q0=2.53E-2;
u0 = [c0; q0];
% -------------------------------------------------------------------------
function [pl,ql,pr,qr] = pdexbc(zl,Cl,zr,Cr,t)
q0=2.53E-2;
Dl=4.7E-5;
epsilon=0.45;
u=0.098;
pl = [(u/epsilon)*Cl(1); Cl(2)-q0];
ql = [-1; 0];
pr = [0; 0];
qr = [(1/Dl); 0];
this is the first time that i use matlab so this program is true for this type of système??
thanks in advance for your help!!! please it's urgent
  댓글 수: 5
Andrew Newell
Andrew Newell 2011년 5월 11일
Much better. Thanks!
Walter Roberson
Walter Roberson 2011년 5월 11일
No problem.

댓글을 달려면 로그인하십시오.

답변 (1개)

Jan
Jan 2011년 5월 11일
Faster than asking here is using the debugger:
dbstop if error
Then Mtlab stops, when the error occurs and you can inspect the current values of the variables to find out, what causes the problem.
  댓글 수: 4
Andrew Newell
Andrew Newell 2011년 5월 11일
Also, unless you have a really old version of MATLAB, you should be able to click on a link in the error message to take you to the line where the error was flagged.
Sean de Wolski
Sean de Wolski 2011년 5월 11일
Excellent thank you! I'd always wondered that; since I rarely close MATLAB I find a residual dbstop if error messing with me a day or two after needing it.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 PDE Solvers에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by