Problem with PDE resolution
Show older comments
I get this error message when running my script pdefun.m
Not enough input arguments.
Error in pdefun>heatpde (line 25)
f1=0.1*dudx;
Error in pdepe (line 246)
[c,f,s] = feval(pde,xi(1),t(1),U,Ux,varargin{:});
Error in pdefun (line 6)
sol=pdepe(m,@heatpde,@heatic,@heatbc,x,t);
These are my function and myscript:
m=0;
x = linspace(0,1,6);
t = linspace(0,100,6);
sol=pdepe(m,@heatpde,@heatic,@heatbc,x,t);
u1 = sol (:,:, 1);
u2 = sol (:,:, 2);
figure(1)
surf(x,t,u1)
title
xlabel
ylabel
figure(2)
surf(x,t,u2)
title
xlabel
ylabel
function [c,f,s]=heatpde(x,t,u1,u2,dudx)
c=[1 1]';
f1=0.1*dudx;
f2=0.5*dudx;
f=[f1 f2]';
a=((0.2*u1(x,t)*u2(x,t))/(1+0.1*u1(x,t)+0.02*u2(x,t)+0.03*u1(x,t)*u2(x,t)));
F1=0.5-0.1*u1(x,t)-a;
F2=a-0.7*u2(x,t);
s=[F1 F2]';
end
function u0=heatic(x)
u0=[1.1*x 0.5*x]';
end
function [pl,ql,pr,qr]=heatbc(xl,ul,xr,ur,t)
pl=[0 0]';
ql=[1 1]';
pr=[0 0]';
qr=[1 1]';
end
Answers (1)
Torsten
on 13 May 2022
function [c,f,s]=heatpde(x,t,u,dudx)
c = [1 ;1];
f = [0.1*dudx(1);0.5*dudx(2)];
a = 0.2*u(1)*u(2)/(1+0.1*u(1)+0.02*u(2)+0.03*u(1)*u(2));
s = [0.5-0.1*u(1)-a;a-0.7*u(2)]
end
Categories
Find more on General PDEs 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!