cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community email notifications are disrupted. While we are working to resolve, please check on your favorite boards regularly to keep up with your conversations and new topics.

Matlab translate to Mathcad

saveyoon
1-Newbie

Matlab translate to Mathcad

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
7 REPLIES 7

Rewrite the Matlab equation in Mathcad equation editor style. A very simple task that applies to all sorts of source info, an every day job.

jmG


__________________
� � � � Tom Gutman

Don't know if works in mc14, but you have then Grad operator.

Alvaro

Other version.

Alvaro

Thank you for your support

On 3/25/2009 9:44:18 AM, saveyoon wrote:
>Thank you for your support
___________________________

Before you code a Matlab, don't you show the equations for reviewers ? At this point, if valid ... then make it live and executable in Mathcad. Always think in term of traceability.

jmG



Top Tags