Error using pdepe to solve PDE
Show older comments
Unexpected output of PDEFUN. for this problem PDEFUN must return three column vectors of length 2
Error in solve (line 13)
solution = pdepe(m,@pdefun,@icfun,@bcfun,x,t)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [c,f,s] = pdefun(x,t,u,DuDx)
c = []; f = [0.024;0.170].*DuDx;
y = u(1)-u(2) ;
F = exp(5.73*y)-exp(-11.46*y);
s = [-F,F];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [pl,ql,pr,qr]=bcfun(x1,u1,xr,ur,t)
pl = [0;u1(2)]; ql = [1;0];
pr = [ur(1)-1;0]; qr = [0;1];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function u0 = infun(x)
u0 = [1;0];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
m =0 ;
x = [0 0.005 0.01 .05 .1 .2 .5 .7 .9 .95 .99 .995 1];
t = [0 .005 .01 .05 .1 .5 1 1,5 2];
solution =pdepe(m,@pdefun,@icfun,@bcfun,x,t);
u1 = solution(:,:,1);
u2 = solution(:,:,2);
figure(1)
surf(x,t,u1)
figure(2)
surf(x,t,u2)
Accepted Answer
More Answers (0)
Categories
Find more on Eigenvalue Problems in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!