Finding intersection point of the lines

1,486 ビュー (過去 30 日間)
Muhammad
Muhammad 2012 年 3 月 2 日
コメント済み: Vladimir Jara 2022 年 9 月 23 日
Hi I have data sets for two lines. i.e. x1,y1 and x2,y2. So i can plot the lines using these point data sets. I would like to know the point (x,y)where these lines intersect each other. Please note that i have tried both [x,y]=intersections(x1,y1,x2,y2); and [x,y]=curveintersect(x1,y1,x2,y2);
i would appreciate if you can tell me the exact command for this purpose.
Regards
  1 件のコメント
Jorge Celedón
Jorge Celedón 2018 年 12 月 13 日
編集済み: madhan ravi 2018 年 12 月 13 日

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

採用された回答

Jonathan Sullivan
Jonathan Sullivan 2012 年 3 月 2 日

その他の回答 (4 件)

Jorge Celedón
Jorge Celedón 2018 年 12 月 13 日
編集済み: madhan ravi 2018 年 12 月 13 日
  2 件のコメント
Nicholas Ayres
Nicholas Ayres 2022 年 1 月 26 日
Heads up to people who find this. This requires the Mapping Toolbox
Vladimir Jara
Vladimir Jara 2022 年 9 月 23 日
thanks for the heds up!

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


Andrei Bobrov
Andrei Bobrov 2012 年 3 月 5 日
data = rand(20,3);
x1 = sort(data(:,2));
x2 = sort(data(:,3));
y = data(:,1);
pp = interp1(x1,y,'linear','pp');
pp2 = interp1(x2,y,'linear','pp');
xx = xx(max(x1(1),x2(1)) <= xx & min(x1(end),x2(end)) >= xx);
func = @(x)ppval(pp,x)-ppval(pp2,x);
xb = xx([true; diff(func(xx) > 0) ~= 0]);
i1 = hankel(1:2,2:numel(xb));
xout = arrayfun(@(z)fzero(func, xb(i1(:,z))), (1:size(i1,2))' )
  1 件のコメント
Agnieszka Dybalska
Agnieszka Dybalska 2021 年 1 月 6 日
It returns - not known function xx...

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


mohammed wasiullah
mohammed wasiullah 2017 年 4 月 5 日
how to find the intersection between the curve and the straight ?
  1 件のコメント
Tan  Kah Loon
Tan Kah Loon 2017 年 4 月 18 日
Example,y1=x^2+2x+3,y2=2x^2+3x+4 , you have to combine two eq and you get ((x^2+X+1)), type f=[1 1 1] to get the polynomials func and roots (f) for its roots.Next, you have to type your 1st equation into p=[1 2 3], after that, pvals=polyval (p,-0.5) and you will find the 1st intersection. The 2nd intersection use back the same method to find.

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


Preetham Manjunatha
Preetham Manjunatha 2022 年 2 月 8 日
Here is the link to find the intersection point of two line segments/lines. A fast two line intersection point finder based on the line parametric space. Finds the intersection point between two lines if it exists or else submits NaN.

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by