How do i understand the output of a solve function?

4 ビュー (過去 30 日間)
Mikkel
Mikkel 2014 年 5 月 20 日
コメント済み: Mikkel 2014 年 6 月 9 日
Hi I have solved two equations and now I would like to calculate/simplify the results, before I turn them from rad's to deg's. But somehow I wont allow me to. My code (so far) looks like this:
syms x
eta = ((30+42)/2)*(pi/180);
gamma = 2*pi/3;
X = solve(1*cos(gamma-eta)-1.2*cos(x-eta),x)
Y = solve(1*sin(gamma-eta)-1.2*sin(x-eta),x)
My results then become
X =
pi/5 + acos(12553449285915085/144115188075855872)
pi/5 - acos(12553449285915085/144115188075855872)
Y =
pi/5 + asin(22394642186961775/27021597764222976)
(6*pi)/5 - asin(22394642186961775/27021597764222976)
what I would like to do is simmelar to
>> pi/5 + acos(12553449285915085/144115188075855872)
ans =
2.1119
>> radtodeg(ans)
ans =
121.0028
But this I can only do from the command window, How do I do this from my code?
  2 件のコメント
Star Strider
Star Strider 2014 年 5 月 20 日
The obvious suggestion is for you to post the relevant parts of your script ‘.m’ file.
What errors or unexpected results do you get when those commands are part of your script file?
Mikkel
Mikkel 2014 年 6 月 9 日
The unexpected result would be that of the secound section with code.. and what I would like was the theerd code section. But I found that a simple eval(solve(...)) solved my problem.

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

採用された回答

Mischa Kim
Mischa Kim 2014 年 5 月 21 日
Mikkel, use
X = vpa(solve(1*cos(gamma-eta)-1.2*cos(x-eta),x))
Y = vpa(solve(1*sin(gamma-eta)-1.2*sin(x-eta),x))
instead.
  1 件のコメント
Mikkel
Mikkel 2014 年 6 月 9 日
This seemed to give me the same result. But a eval(solve(...)) gave me the expresion in the form that I was looking for

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by