![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/387718/image.png)
Finding the intersec point using InterX?
19 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
ErikJon Pérez Mardaras
am 21 Okt. 2020
Kommentiert: ErikJon Pérez Mardaras
am 25 Okt. 2020
I am trying to find the intersect point of two lines using "InterX".
More concretely, I want to find the intersect point of the line L1 which two coordinates are x1=1,y1=1 and x2=3 y2=6
and the line L2 which two coordinates are x1=-2 y1=8 and x2=2 y2=-1
I don´t know if I understanded well the "InterX" function, but here is the code I have executed:
hold on
x=linspace(-30,30)
L1=[1 3;
1 6]
L2=[-2 2;
8 -1]
P=InterX(L1,L2);
plot(L1)
plot(L2)
plot(P,'ro')
And the result Matlab gives to me is completly absurd, in the following image:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/387653/image.png)
What am I doing wrong? How can I properly use the "InterX" function? I have searched in the community but I didn´t understand it very well as you can see
0 Kommentare
Akzeptierte Antwort
KSSV
am 21 Okt. 2020
Bearbeitet: KSSV
am 21 Okt. 2020
You should read the documentation/ help given in the InterX function. Your curves/ data points should be such that :
L1 = [x11 x12 ; y11 y12] ;
L2 = [x21 x22 ; y21 y22] ;
L1=[1 3;
1 6]
L2=[-2 2;
8 -1]
P=InterX(L1,L2);
figure
hold on
plot(L1(1,:),L1(2,:),'r')
plot(L2(1,:),L2(2,:),'b')
plot(P(1),P(2),'ro')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/387718/image.png)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!