Insufficient input arguments. continues to come out. Help

7 Ansichten (letzte 30 Tage)
SUNGJIN KIM
SUNGJIN KIM am 28 Mär. 2022
Beantwortet: Voss am 28 Mär. 2022
2.187
%This progrem will use dfuncl.m
tspan = 0: 0.05: 8;
y = [0.4; 0;0];
[t , y]= ode23(odefun, tspan, y);
plot (t, y(:, 1));
xlabel ('t');
ylabel ('y(1');
title ('problem 2.187');
function f = odefun( ~ , y )
u = 0.5;
k = 100;
m = 5;
f=zeros(2,1);
f(1) = y(2);
f(2) = -u*9.81*sign(y(2))-k*y(1)/m;
end
-------------------------------------------------------------------
>> pr187
Insufficient input arguments.
an error occurred : pr187>odefun (16. line)
f(1) = y(2);
an error occurred: pr187 (5. line )
[t , y]= ode23(odefun, tspan, y);

Antworten (1)

Voss
Voss am 28 Mär. 2022
Try changing this:
[t , y]= ode23(odefun, tspan, y);
to this:
[t , y]= ode23(@odefun, tspan, y);

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by