I do not know about the matlab.
I want to convert Matlab file to Mathcad.
Matlab example are below.
Please help me.
---------��Matlab example-------------
clear all;
clc;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Kinematics %%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
theta2 = deg2rad(120);
dot_theta2 = 2*pi;
ddot_theta2 = 0;
q = zeros(2,1);
q(1) = deg2rad(16);
q(2) = deg2rad(270);
%%% Non-Linear Equation by Newton's method %%%
Max_Iter = 100;
No_Iter = 0;
Tol = 0.00000001;
index = 1;
while (index)
PHI = [ 9*cos(q(1)) + 7*cos(q(2)) + 5*cos(theta2) - 11 ;
9*sin(q(1)) + 7*sin(q(2)) + 5*sin(theta2) - 0 ];
Jacobian = [ -9*sin(q(1)), -7*sin(q(2));
9*cos(q(1)), 7*cos(q(2)) ];
Inv_J = inv(Jacobian);
F = Inv_J * PHI;
if ( max(abs(F)) > Tol )
No_Iter = No_Iter+1;
else
index = 0;
break;
end
if No_Iter > Max_Iter
break;
end
q = q - F;
end % The end of while (index)
q % Position data
%%% Linear Equation %%%
%% Velocity Equation %%%
B = [ 5*sin(theta2)*dot_theta2;
-5*cos(theta2)*dot_theta2 ];
dot_q = Inv_J * B
%% Acceleration Equation %%%
C = [ 5*cos(theta2)*dot_theta2^2 + 5*sin(theta2)*ddot_theta2 + 9*cos(q(1))*dot_q(1)^2 + 7*cos(q(2))*dot_q(2)^2;
5*sin(theta2)*dot_theta2^2 - 5*cos(theta2)*ddot_theta2 + 9*sin(q(1))*dot_q(1)^2 + 7*sin(q(2))*dot_q(2)^2 ];
ddot_q = Inv_J * C