function xp = cap8_robot2gdlTANH(t,x) %vector de posición articular q1=x(1); q2=x(2); q = [q1; q2]; %vector de velocidad articular qp1=x(3); qp2=x(4); qp = [qp1; qp2]; m1=23.902; l1=0.45; lc1=0.091; I1=1.266; b1=2.288; m2=3.880; l2=0.45; lc2=0.048; I2=0.093; b2=0.175; g=9.81; theta1=m1*lc1*lc1+m2*l1*l1+m2*lc2*lc2+I1+I2; theta2=l1*m2*lc2; theta3=m2*lc2*lc2+I2; theta4=g*(lc1*m1+m2*l1); theta5=g*m2*lc2; theta6=b1; theta7=b2; M=[theta1+2*theta2*cos(q2), theta3+theta2*cos(q2); theta3+theta2*cos(q2), theta3]; C=[ -2*theta2*sin(q2)*qp2, -theta2*sin(q2)*qp2; theta2*sin(q2)*qp1, 0]; gq11=theta4*sin(q1)+theta5*sin(q1+q2); gq21=theta5*sin(q1+q2); gq=[gq11; gq21]; fr=[theta6*qp1; theta7*qp2]; [~ , tau]=cap8_TANHrobot2gdl(q,qp); qpp = M^(-1)*(tau-C*qp-gq-fr); %vector de salida\n xp = [qp1; qp2; qpp(1); qpp(2)]; end