Index exceeds array dimensions. Index value 9 exceeds valid range [1-1] for array 'm2'.

10 vues (au cours des 30 derniers jours)
I have tried to solve my problem many times but matlab throws this error, someone can help me please.
Error: "Index exceeds array dimensions. Index value 9 exceeds valid range [1-1] for array 'm2'."
function [dd_theta1,dd_theta2]=ss_barra1(T1,T2,d_theta1,theta1,dd_theta2 ,d_theta2,theta2)
%Los valores de las constantes que definen al robot son:
l1 = 2; % longitud en metros
l2 = 1; % longitud en metros
g = 9.81; % aceleración de la gravedad m/s^2
m1 = 2; % masa en kg
m2 = 1; % masa en kg
dd_theta1=(T1-m2*(l1*l2*cos(theta2)+(l2^2))*dd_theta2+m2*l1*l2*sin(theta2)*(2*d_theta1*d_theta2+(d_theta2^2))+(m1+m2)*l1*g*cos(theta1)+m2*g*l2*cos(theta1+theta2))/(m1*(l1^2)+m2((l1^2)+2*l1*l2*cos(theta2)+(l2^2)));
dd_theta2=(T2-m2*(l1*l2*cos(theta2)+(l2^2))*dd_theta1-m2*l1*l2*sin(theta2)*(d_theta1^2)-m2*g*l2*cos(theta1+theta2))/(m2*(theta2^2));

Réponses (1)

Walter Roberson
Walter Roberson le 27 Mai 2023
m2((l1^2)
MATLAB has no implied multiplication. That is a request to index m2

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Tags

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by