Finding the root of a function between an interval

11 ビュー (過去 30 日間)
Pedro Almeida
Pedro Almeida 2022 年 12 月 5 日
コメント済み: Pedro Almeida 2022 年 12 月 5 日
Probably a stupid question, but how do I find the root of test1 between the interval [0,1]?
x = 0:0.1:2;
y = 1 - sin(x);
z = x.^2;
test1 = y - z;

採用された回答

Torsten
Torsten 2022 年 12 月 5 日
編集済み: Torsten 2022 年 12 月 5 日
format long
y = @(x) 1 - sin(x);
z = @(x) x.^2;
test1 = @(x) y(x)-z(x);
x = fzero(test1,[0 1])
x =
0.636732650805282

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by