フィルターのクリア

Is it possible to get multiple 0s from fzero?

7 ビュー (過去 30 日間)
Cassandra Meyer
Cassandra Meyer 2022 年 1 月 30 日
コメント済み: Cassandra Meyer 2022 年 1 月 31 日
I have already found the three zeros of this function by setting it to 0, and I am told to use fzero to and compare the two values. However, I have seen a question or two mentioning that I cannot get multiple zeros from fzero. Do I run this three times in separate intervals or is there another way?
fun = @(x) x^3 -4*x^2 +1;
x0 = [-5 5]; % initial interval
x = fzero(fun,x0)

採用された回答

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2022 年 1 月 31 日
In your exercise, ie. a polynomial, the first try is roots() and then fzero() with different intervals can be an option for real roots.
SOls = roots([1 -4 0 1])
SOls = 3×1
3.9354 0.5374 -0.4728
fun = @(x) x^3 -4*x^2 +1;
X01 = [2 5];
x1 = fzero(fun,X01)
x1 = 3.9354
X02 = [0 2];
x2 = fzero(fun,X02)
x2 = 0.5374
X03 = [-1 0];
x3 = fzero(fun,X03)
x3 = -0.4728
  1 件のコメント
Cassandra Meyer
Cassandra Meyer 2022 年 1 月 31 日
Okay great, thank you so much!

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by