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

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 commentaire

How are functions control and Dynamique defined? Without them, it is quite difficult to track down the error?

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Numerical Integration and Differential Equations dans Centre d'aide et File Exchange

Produits

Version

R2017a

Tags

Question posée :

le 18 Avr 2020

Commenté :

le 18 Avr 2020

Community Treasure Hunt

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

Start Hunting!

Translated by