Problems in solve iteratively calculation

6 ビュー (過去 30 日間)
Elisandro Peixoto
Elisandro Peixoto 2020 年 5 月 29 日
コメント済み: Ameer Hamza 2020 年 5 月 29 日
Hi everyone, I'm newbie in Matlab. I'm trying to solve an equation iteratively, but the answer showed is different from my calculator.
syms dt2;
solve((-2.4638*cos(dt2))-dt2 + 2.6628 == 0.0785,dt2)
The answer that I expect is 0.700201189 (I found it in my calculator), but I have 0.14711303119198522137688950797546 in Matlab.
Along with the answer, it shows a messagem:
"Warning: Cannot solve symbolically. Returning a numeric approximation instead."
  2 件のコメント
darova
darova 2020 年 5 月 29 日
Use vpasolve
Elisandro Peixoto
Elisandro Peixoto 2020 年 5 月 29 日
Thank You!

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

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 5 月 29 日
If you look at the graph of this equation, you can see that it has two solutions in the interval [0 1].
syms dt2;
f = (-2.4638*cos(dt2))-dt2 + 2.6628 - 0.0785;
fplot(f, [0 1])
yline(0)
MATLAB is not able to solve it analytically (probably such a solution does not exist for this equation), so you will need to a numerical method, e.g., vpasolve() or fsolve(). An easy way to get the required solution is to give an initial guess such that it is closer to the required root. For example
f = @(dt2) (-2.4638*cos(dt2))-dt2 + 2.6628 - 0.0785;
sol = fsolve(f, 1)
Result
sol =
0.7002
  2 件のコメント
Elisandro Peixoto
Elisandro Peixoto 2020 年 5 月 29 日
Thank You so much!
Ameer Hamza
Ameer Hamza 2020 年 5 月 29 日
I am glad to be of help.

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

その他の回答 (0 件)

カテゴリ

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