Insufficient input arguments. continues to come out. Help
1 次查看(过去 30 天)
显示 更早的评论
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);
0 个评论
回答(1 个)
Voss
2022-3-28
Try changing this:
[t , y]= ode23(odefun, tspan, y);
to this:
[t , y]= ode23(@odefun, tspan, y);
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!