Not Enough Input Arguments ode45
Show older comments
I have a coupled higher order set of ODE's to solve and plot. I have included my MATLAB files below.
F = m2(ddotdot - (L1+d)thetadot^2) + m2*g*sin(theta)
T = [(1/3)m1(L1)^2 + (1/12)m2(L2)^2 + m2(L1+d)^2]thetadotdot + (2(m2)(L1+d)ddot*thetadot + gcos(theta)[m1(L1/2) + m2(L1 + d
I used Euler's Method to bring F and T to first order equations.
I now want to used ode45 to solve this pair of equations.
I have 2 Matlab files:
ti = 0;
tf = 10;
theta0 = 0;
thetadot0 = 0;
d0 = 0;
ddot0 = 0;
[t,y]=ode45(@fdynamics,[ti tf],[theta0 thetadot0 d0 ddot0]);
AND
function fdynamics = myode(theta,thetadot,d,ddot)
F = 1;
T = 1;
m1 = 1;
m2 = 1;
g = 9.81;
l1 = 1;
l2 = 1;
fdynamics = zeros(2,1);
fdynamics(1) = (F-m2*g*sin(theta))/m2;
fdynamics(2) = (T-(2*m2*(l1+d))*thetadot*ddot -g*cos(theta)*(m1*(l1/2)+m2*(l1+d)) /((1/3)*m1*(l1)^2 + (1/12)*m2*l2^2 + m2(l1+d)^2));
When I click RUN, it says:
>> attempt
Not enough input arguments.
Error in fdynamics (line 14)
fdynamics(2) = (T-(2*m2*(l1+d))*thetadot*ddot
-g*cos(theta)*(m1*(l1/2)+m2*(l1+d)) /((1/3)*m1*(l1)^2 + (1/12)*m2*l2^2 +
m2(l1+d)^2));
Error in odearguments (line 87)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options,
varargin);
Error in attempt (line 7)
[t,y]=ode45(@fdynamics,[ti tf],[theta0 thetadot0 d0 ddot0]);
Answers (1)
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!