solve 2 equation of 2 unknown

조회 수: 6 (최근 30일)
Abdulaziz
Abdulaziz 2013년 4월 27일
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);

채택된 답변

Ahmed A. Selman
Ahmed A. Selman 2013년 4월 27일
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
Abdulaziz
Abdulaziz 2013년 4월 27일
Thank you it works

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by