Finding the root of a function between an interval

7 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Testing Frameworks 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by