Intersection point of x axis

Respuestas (1)

Star Strider
Star Strider el 22 de Nov. de 2020

3 votos

It depends on the curve and how you define it.
Example —
x = linspace(-5, 5);
y = x.^2-2;
zx = find(diff(sign(y)));
for k = 1:numel(zx)
xint(k) = interp1(y(zx(k)+[-1 1]), x(zx(k)+[-1 1]), 0);
end
figure
plot(x, y)
hold on
plot(xint, zeros(size(xint)), 'p')
hold off
grid
.

2 comentarios

Steven
Steven el 4 de Dic. de 2022
This worked perfectly for my equation thank you
Star Strider
Star Strider el 5 de Dic. de 2022
My pleasure!

Iniciar sesión para comentar.

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Productos

Versión

R2020b

Preguntada:

el 22 de Nov. de 2020

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