Finding the root of a function between an interval

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;

 Respuesta aceptada

Torsten
Torsten el 5 de Dic. de 2022
Editada: Torsten el 5 de Dic. de 2022
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

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Centro de ayuda y File Exchange.

Productos

Versión

R2022b

Etiquetas

Preguntada:

el 5 de Dic. de 2022

Comentada:

el 5 de Dic. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by