MATLAB Answers

ODE 45 Not enough input arguments

18 views (last 30 days)
Mauricio San Román Caraza
Commented: Jan on 26 Feb 2021
It says i don't have enough input agruments in line 3 of the function section and I dont know what is wrong
global m c k Omega f0
k=2000; % N/m
m=5; %kg
c=20; %kg/s
Omega= 25;
x0=[0 0];
function rl=f(t,y)
global m c k Omega f0
rl=[y(1); f/m-(c*y(1))/m-k*y(2)/(4*m)];
Jan on 26 Feb 2021
As far as I understand, your problem is solved. But it may help to improve future questions: You have still not posted a complete copy of the error message, but just the part, which explains where the problem occurred.

Sign in to comment.

Answers (1)

Jan on 25 Feb 2021
We cannot see it, because you have not posted the complete code. But this has been the reason in many other questions in this forum:
[t, y] = ode45(rl, ...)
This calls rl without inputs. You want to provide the handle of the function instead:
[t, y] = ode45(@rl, ...)


Community Treasure Hunt

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

Start Hunting!