using solve when it involve trigonometrics

3 ビュー (過去 30 日間)
Hamza  Makhamreh
Hamza Makhamreh 2017 年 5 月 15 日
コメント済み: Hamza Makhamreh 2017 年 5 月 15 日
Hi , I'm trying to solve this simple equaiton, but matlab giving me this message error. Could you help me? I've tried too many ways but its not working with me. 2*V(1-cos(a)) = E*a Where E=70 and V=170; I tried this: syms a1 E=70; V=170 ; eq=2*V -2*V*cos(a)- E*a==0; a = solve(eq, a)
  1 件のコメント
Star Strider
Star Strider 2017 年 5 月 15 日
Consider vpasolve.

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

採用された回答

Cam Salzberger
Cam Salzberger 2017 年 5 月 15 日
編集済み: Cam Salzberger 2017 年 5 月 15 日
If you make the corrections as Steven suggested, you'll get:
Warning: Cannot solve symbolically. Returning a numeric approximation instead.
> In solve (line 304)
a =
0
Not all equations can be solved symbolically. If you want to check your answer, here's a good way to do it:
>> eq
eq =
340 - 340*cos(a) - 70*a == 0
fplot(340-340*cos(a)-70*a)
hold on
fplot(0)
If you pan around a bit, you'll notice that there are only about 5 solutions to that equation.
  3 件のコメント
Hamza  Makhamreh
Hamza Makhamreh 2017 年 5 月 15 日
Thanks for you Mr. Cam, I tried it, it works fine, but what i was trying to find the solution in symbolic form though.
Hamza  Makhamreh
Hamza Makhamreh 2017 年 5 月 15 日
@Steven Lord, Could you explain farther? let say my solution is sth. around 0.4156. What shall i do?

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

その他の回答 (1 件)

Steven Lord
Steven Lord 2017 年 5 月 15 日
編集済み: Steven Lord 2017 年 5 月 15 日
You're missing a comma between the end of your syms command and the start of the next command. You also have a typo: you define the symbolic variable a1 then use the variable a in your code.
  1 件のコメント
Hamza  Makhamreh
Hamza Makhamreh 2017 年 5 月 15 日
this due to copy-paste issue.

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by