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

7 次查看(过去 30 天)
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));

回答(1 个)

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

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

标签

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by