Intersection point of x axis

回答 (1 件)

Star Strider
Star Strider 2020 年 11 月 22 日

3 投票

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 件のコメント

Steven
Steven 2022 年 12 月 4 日
This worked perfectly for my equation thank you
Star Strider
Star Strider 2022 年 12 月 5 日
My pleasure!

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

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

製品

リリース

R2020b

質問済み:

2020 年 11 月 22 日

コメント済み:

2022 年 12 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by