Clear Filters
Clear Filters

i don't find the error

2 views (last 30 days)
mouna
mouna on 11 May 2011
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 Comments
Andrew Newell
Andrew Newell on 11 May 2011
Much better. Thanks!
Walter Roberson
Walter Roberson on 11 May 2011
No problem.

Sign in to comment.

Answers (1)

Jan
Jan on 11 May 2011
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 Comments
Andrew Newell
Andrew Newell on 11 May 2011
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 on 11 May 2011
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.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!