Error using odearguments Inputs must be floats, namely single or double.

5 Ansichten (letzte 30 Tage)
Anis Frej
Anis Frej am 18 Apr. 2020
Kommentiert: Ameer Hamza am 18 Apr. 2020
Hello,
I used ode45 to solve the system but when i run this code i have an error can you help me
tf = 2;
q0 = [pi/4;0;0;pi/2;0;0]; qp0 = [0;0;0;0;0;0];
qr0 = [pi/12;0;0;pi/5;0;0]; qpr0 = [0;0;0;0;0;0];
x0 = [q0;qp0;qr0;qpr0];
%---------- Intégration numérique ------------------------------
[Temps, LesX] = ode45(@systeme,[0 tf],x0);
%----------------------------------------------------------------------------
function xp = systeme(t,x)
q = x(1:6); qp = x(7:12); qr = x(13:18); qpr = x(19:24);
xp(1:6) = qp;
xp(13:18) = qpr;
u = control(t,x);
[M,Mr,C,Cr,G,Gr] = Dynamique(q,qp,qr,qpr);
qpp = (inv(M)) * ((-C * qp) - G);
qppr = (inv(Mr)) * ((-Cr * qpr) - Gr + u);
xp =[qp;qpp;qpr;qppr];
return
This is the following error:
Error using odearguments (line 113)
Inputs must be floats, namely single or double.
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in main (line 11)
[Temps, LesX] = ode45(@systeme,[0 tf],x0);
  1 Kommentar
Ameer Hamza
Ameer Hamza am 18 Apr. 2020
How are functions control and Dynamique defined? Without them, it is quite difficult to track down the error?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by