Insufficient input arguments. continues to come out. Help

조회 수: 7 (최근 30일)
SUNGJIN KIM
SUNGJIN KIM 2022년 3월 28일
답변: Voss 2022년 3월 28일
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);

답변 (1개)

Voss
Voss 2022년 3월 28일
Try changing this:
[t , y]= ode23(odefun, tspan, y);
to this:
[t , y]= ode23(@odefun, tspan, y);

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by