Why am I getting an error on this?

1 次查看(过去 30 天)
Ali Almakhmari
Ali Almakhmari 2022-12-14
编辑: Torsten 2022-12-14
Why am I getting an error that says "Not enough input arguments."
function dydx = funct(x, y, z)
a = 1;
b = 2;
c = 3;
dydx = a*y + b*z + c*x;
end
y0 = 1;
z0 = 2;
[x, y] = ode45(@funct, [0, 10], [y0, z0]);
plot(x, y);
  2 个评论
Bora Eryilmaz
Bora Eryilmaz 2022-12-14
func() takes 3 scalar arguments (x, y, z), but you are passing a single vector argument ([y0, z0], etc.) to it.
Torsten
Torsten 2022-12-14
编辑:Torsten 2022-12-14
If you want to solve for two unknown functions (y and z), you need two differential equations, not only one.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by