Not enough input arguments

1 次查看(过去 30 天)
I am using the 'pdepe' command but I keep getting this error-
Not enough input arguments.
Error in differential>pde1pde (line 15)
k = (1.22-0.002*u)/36;
Error in differential (line 12)
sol = pdepe(m, pde1pde, pde1ic, pde1bc, x, t);
Here's the code I have-
clc
global rho Cp MW dH T0
rho = 906;
Cp = 0.4365;
MW = 104.15;
dH = -17800;
T0 = 20 + 273.15;
x = linspace(0,10,20);
t = linspace(0, 1000000, 10000);
m = 0;
sol = pdepe(m, pde1pde, pde1ic, pde1bc, x, t);
function [c,f,s] = pde1pde(x, t, u, dudx)
k = (1.22-0.002*u)/36;
xp = 1-x;
A0 = 1.964*(10^5)*exp(-10040/u);
A1 = 2.57-5.05*u*(10^(-3));
A2 = 9.56-1.76*u*(10^(-2));
A3 = -3.03+7.85*u*(10^(-3));
A = A0*exp(A1*(xp) + A2*(xp^2) + A3*(xp^3));
c = (rho*Cp)/k;
f = dudx;
s = (((rho/MW)*x)^(2.5))*A*(-dH)/k;
end
function u0 = pde1ic(x)
u0 = T0;
end
function [pl, ql, pr, qr] = pde1bc(xl, ul, xr, ur, t)
pl = 0;
ql = 1;
pr = 0;
qr = 1;
end

采纳的回答

Stephen23
Stephen23 2020-7-11
Exactly as the pdepe documentation explains (and its examples show) you need to provide three function handles as its 2nd, 3rd, and 4th inputs. Instead your code calls those three functions without any input arguments, thus the error message.
You can define three function handle like this:
sol = pdepe(m, @pde1pde, @pde1ic, @pde1bc, x, t);
% ^ ^ ^ define function handles

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by