Two equations of two unknown angles

7 ビュー (過去 30 日間)
Ravi N
Ravi N 2021 年 2 月 23 日
コメント済み: Ravi N 2021 年 2 月 23 日
If I have:
A = 87; B = 65; C = 73; D = 92;
And the two equations are:
D*sin(200)+A*sin(x)+B*sin(y)=0;73+D*cos(200)+A*cos(x)+B*cos(y)=0
How do I write a code to find x and y?
What is the solution to this error?
  2 件のコメント
Walter Roberson
Walter Roberson 2021 年 2 月 23 日
not eq space and then [list] but eq = and then the list
Ravi N
Ravi N 2021 年 2 月 23 日
Thank you, however I still get the invalid expression error.

サインインしてコメントする。

採用された回答

John D'Errico
John D'Errico 2021 年 2 月 23 日
編集済み: John D'Errico 2021 年 2 月 23 日
First, I would recognize that you PROBABLY intended 200 to be a number in DEGREES, not radians. (200 radians would seem to make little sense.) Therefore, you need to use sind and cosd, not sin and cos.
Since you know how to use solve, (sort of) I'll do it that way.
syms x y
A = 87; B = 65; C = 73; D = 92;
E1 = D*sind(200)+A*sind(x)+B*sind(y) == 0
E1 = 
E2 = 73+D*cosd(200)+A*cosd(x)+B*cosd(y) == 0
E2 = 
As you can see, sind and cosd convert the problem internally into one in radians. The x and y solutions will still be in the form of degrees though.
[xsol,ysol] = solve(E1,E2,x,y)
xsol = 
ysol = 
vpa(xsol)
ans = 
vpa(ysol)
ans = 
These will be angles in degrees, since I used sind and cosd. There are two primary solutions, but there are infinitely many solutions. We could add integer multiples of 360 degrees to those solutions.
  1 件のコメント
Ravi N
Ravi N 2021 年 2 月 23 日
編集済み: Ravi N 2021 年 2 月 23 日
Thank you for the help!!!

サインインしてコメントする。

その他の回答 (1 件)

David Hill
David Hill 2021 年 2 月 23 日
fun = @solution;
x0 = [0,0];
I = fsolve(fun,x0);%solution
function f = solution(x)
A=87;B=65;D=92;
f(1)=D*sin(200)+A*sin(x(1))+B*sin(x(2));
f(2)=73+D*cos(200)+A*cos(x(1))+B*cos(x(2));
end
  1 件のコメント
Ravi N
Ravi N 2021 年 2 月 23 日
Thank you for the help !!!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeNumber Theory についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by