Trying to solve 4 equations with 4 unknowns
Show older comments
Please forgive me if I have made a simple mistake somewhere, i am new to matlab. I am trying to solve 4 equations with 4 unknowns using the following code (the equations can be seen in the code):
clear all clc
%Variables mr1 = 0.00367; mr2 = 0.00347; mr3 = 0.00326; mr4 = 0.00285;
t1 = (0.*pi./180); %Theta 1 t2 = (150.*pi./180); %Theta 2
L2 = 100; %Length 2
%Equations syms t3 t4 L3 L4 eqn1 = (mr1.*cos(t1))+(mr2.*cos(t2))+(mr3.*cos(t3))+(mr4.*cos(t4)); eqn2 = (mr1.*sin(t1))+(mr2.*sin(t2))+(mr3.*sin(t3))+(mr4.*sin(t4)); eqn3 = (mr2.*cos(t2).*L2)+(mr3.*cos(t3).*L3)+(mr4.*cos(t4).*L4); eqn4 = (mr2.*sin(t2).*L2)+(mr3.*sin(t3).*L3)+(mr4.*sin(t4).*L4);
sol = solve([eqn1, eqn2, eqn3, eqn4], [t3, t4, L3, L4]);
t3sol = sol.t3 t4sol = sol.t3 L3sol = sol.L3 L4sol = sol.L4
I get an output like this:
t3sol =
2*atan(145605206485276482748420948900669138501392424635563243778690631591919075705994813578316926027989942318591849140567990554464632833666078054343769210242464652557494104884833704308910104549495090351334711843879^(1/2)/1855825184424491570581294001272297294497157463865627079281047908576644569912918927976471277564357404261 - 783150673641568928799120402730188800000/112313626000065159014893967186374350903) -2*atan(145605206485276482748420948900669138501392424635563243778690631591919075705994813578316926027989942318591849140567990554464632833666078054343769210242464652557494104884833704308910104549495090351334711843879^(1/2)/1855825184424491570581294001272297294497157463865627079281047908576644569912918927976471277564357404261 + 783150673641568928799120402730188800000/112313626000065159014893967186374350903)
t4sol =
2*atan(145605206485276482748420948900669138501392424635563243778690631591919075705994813578316926027989942318591849140567990554464632833666078054343769210242464652557494104884833704308910104549495090351334711843879^(1/2)/1855825184424491570581294001272297294497157463865627079281047908576644569912918927976471277564357404261 - 783150673641568928799120402730188800000/112313626000065159014893967186374350903) -2*atan(145605206485276482748420948900669138501392424635563243778690631591919075705994813578316926027989942318591849140567990554464632833666078054343769210242464652557494104884833704308910104549495090351334711843879^(1/2)/1855825184424491570581294001272297294497157463865627079281047908576644569912918927976471277564357404261 + 783150673641568928799120402730188800000/112313626000065159014893967186374350903)
L3sol =
(1117065360735908797174599123545351366956818944*145605206485276482748420948900669138501392424635563243778690631591919075705994813578316926027989942318591849140567990554464632833666078054343769210242464652557494104884833704308910104549495090351334711843879^(1/2))/813864050423265267123648162719845372652463428208168821521460432192724606358211586091191271325924447569561174040540157589028852856171173829007195875 + 269076443412277322481421255418489856/9177804024207267325066365902401625 269076443412277322481421255418489856/9177804024207267325066365902401625 - (1117065360735908797174599123545351366956818944*145605206485276482748420948900669138501392424635563243778690631591919075705994813578316926027989942318591849140567990554464632833666078054343769210242464652557494104884833704308910104549495090351334711843879^(1/2))/813864050423265267123648162719845372652463428208168821521460432192724606358211586091191271325924447569561174040540157589028852856171173829007195875
L4sol =
269076443412277322481421255418489856/9177804024207267325066365902401625 - (126755589632*145605206485276482748420948900669138501392424635563243778690631591919075705994813578316926027989942318591849140567990554464632833666078054343769210242464652557494104884833704308910104549495090351334711843879^(1/2))/14683436456056444633026523813890104994992297564772671700049999328718805174761190767614788921233178879756892581125 (126755589632*145605206485276482748420948900669138501392424635563243778690631591919075705994813578316926027989942318591849140567990554464632833666078054343769210242464652557494104884833704308910104549495090351334711843879^(1/2))/14683436456056444633026523813890104994992297564772671700049999328718805174761190767614788921233178879756892581125 + 269076443412277322481421255418489856/9177804024207267325066365902401625
How can I simplify my output numbers so i get the format of the theta values to be xxx Degrees and the L to me in xxx mm.
Thanks!
Answers (0)
Categories
Find more on Mathematics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!