フィルターのクリア

Solve non-linear equation.

1 回表示 (過去 30 日間)
Xavi Alm
Xavi Alm 2019 年 11 月 30 日
編集済み: Matt J 2019 年 12 月 1 日
Hi to all,
Im solving the next equation (I use 2 different methods of writing the equation)
%Variable
syms theta
%Definicion de funciones/equaciones.
Equation = tan(theta)- theta -0.023;
Equation_fun = @(theta) tan(theta)- theta - 0.023
To solve it I use the following methods:
%Resolucion numerica
S = fsolve(Equation_fun,0.5);
S = fzero(Equation_fun,0.5);
These methods strongly depend on the initial condition. I want to find a method that finds all the roots between 0 and 2 pi. Because of the equation I am solving. This equation represents the evolve equation. The correct answer is 0.401. It only appears when the inital condition is near the root.
Thanks for the help!
  1 件のコメント
Matt J
Matt J 2019 年 12 月 1 日
How can 0.401 be the correct answer if the task is to find all roots between 0 and 2*pi?

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

採用された回答

Matt J
Matt J 2019 年 12 月 1 日
編集済み: Matt J 2019 年 12 月 1 日
You can tell fzero to bound the search to a desired sub-interval.
>> fzero(Equation_fun,[0,pi/2])
ans =
0.4012
>> fzero(Equation_fun,[3,3*pi/2])
ans =
4.4945
It can be seen from a plot of the function that these are the only 2 roots.
fplot(Equation_fun,[0,2*pi])
untitled.png

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by