I want to solve this system of partial differential equations: 0.661*du/dt=d/dx(0.051du/dx)-0.1du/dx-0.97*k*(qm-q); dq/dt=k*(qm-q); k=0.01; p=8.314*3.23*1.09*u(1); q1=2.983*100*(0.336*p/(1+0.336*p)+0.0000000005046*power(p,12.608)/(1+0.0000000005046*power(p,12.608))); function pdefun
if true
% code
end
function[c,f,s]=pdefun(z,t,u,du)
p=8.314*3.23*1.09*u(1);
q1=2.983*100*(0.336*p/(1+0.336*p)+0.0000000005046*power(p,12.608)/(1+0.0000000005046*power(p,12.608)));
c=[0.661;1];
f=[0.0051*du(1);0];
s=[-0.1*du(1)-0.97*0.01*(q1-u(2));0.01*(q1-u(2))];
function pdeic
function[u0]=pdeic(z)
u0=[0;0];
function pdebc
function[pa,qa,pb,qb]=pdebc(za,ua,zb,ub,t)
pa=[ua(1)-0.00002;0];qa=[0;0];
pb=[0;0];qb=[1;0];z=0:0.01:1;t=0:30:3600;m=0;
sol=pdepe(m,@pdefun,@pdeic,@pdebc,z,t);
u1=sol(:,:,1);
u2=sol(:,:,2);
fid=fopen('cc.txt','wt');
for i=1:101
fprintf(fid,'%d',u1(i,:));
fprintf(fid,'\n');
end
fclose(fid);
fid=fopen('qq.txt','wt');
for i=1:101
fprintf(fid,'%d',u2(i,:));
fprintf(fid,'\n');
end
fclose(fid);
where did i wrong ?
thank you

 Respuesta aceptada

Torsten
Torsten el 30 de Mayo de 2017
Editada: Torsten el 30 de Mayo de 2017

0 votos

"pdepe" expects boundary conditions for all solution variables in both boundary points. Since the equation for q is a simple ODE, no boundary condition can be specified (except for the ODE equation itself). That's why "pdepe" is not suited to solve your problem.
Best wishes
Torsten.

3 comentarios

kiwihuan
kiwihuan el 30 de Mayo de 2017
so how can i solve the problem? Thank you Best wishes
Torsten
Torsten el 30 de Mayo de 2017
Discretize the spatial derivatives of the first equation and solve the resulting system of ordinary differential equations in the z-grid points using ODE15S.
Look up "method-of-lines" for more details.
Best wishes
Torsten.
kiwihuan
kiwihuan el 30 de Mayo de 2017
thank you very much

Iniciar sesión para comentar.

Más respuestas (0)

Preguntada:

el 30 de Mayo de 2017

Comentada:

el 30 de Mayo de 2017

Community Treasure Hunt

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

Start Hunting!