MATLAB Answers

solve 2 equation of 2 unknown

10 views (last 30 days)
Hi All
I have two equations i am trying to solve. I used the next small code but I received an error message.
the 2 equations: r2*sind(theta2)-r3*sind(theta3)-r4=0 r1+r2*cosd(theta2)-r3*cosd(theta3)=0
Known: r2=3; r3=3.927; r4=0.335; theta2=10;
Code: lear all clc syms theta3 sind(theta3) r1 r2=3; r3=3.927; r4=0.335; theta2=10; t=(r2*sind(theta2)-r3*sind(theta3)-r4); theta3=subs(char(solve(t,theta3))); tt=vpa(r1+r2*cosd(theta2)-r3*cosd(theta3)); r1=subs(char(solve(tt,r1))); theta3 r1
Error: Error using mupadengine/feval (line 157) MuPAD error: Error: Cannot differentiate equation. [numeric::fsolve]
Error in solve (line 160) sol = eng.feval('symobj::solvefull',eqns,vars);

  0 Comments

Sign in to comment.

Accepted Answer

Ahmed A. Selman
Ahmed A. Selman on 27 Apr 2013
Use the code instead:
clc
clear
syms theta3 r1
%sind(theta3) % NOT NEEDED
r2=3;
r3=3.927;
r4=0.335;
theta2=10;
t=(r2*sin(theta2)-r3*sin(theta3)-r4);
theta3=subs(char(solve(t,theta3)));
tt=vpa(r1+r2*cos(theta2)-r3*cos(theta3));
OUT(1)=subs(char(solve(tt(1),r1))); % Can't usr r1=solve(tt,'r1')!
OUT(2)=subs(char(solve(tt(2),r1)));
theta3
OUT

  1 Comment

Abdulaziz
Abdulaziz on 27 Apr 2013
Thank you it works

Sign in to comment.

More Answers (0)


Translated by