Find intersection points between lines
Show older comments
Hello, I've plot 5 lines on the same graph with their edge coordinates. Now, I wish to find the intersection point coordinates (xi, yi) from any 2 intersecting lines specifically. Example: Intersection point between bottom slanting line and horizontal straight line.I used polyxpoly function, but it's not working...Is there any better way to do this?. Thank you.
%Bottom slanting line
x1=[1000,1];
y1=[1E-8, 1E-5];
loglog(x1,y1)
hold on
%Top slanting line
x2=[1,3000];
y2=[1E-3,3.5E-7];
loglog(x2,y2)
hold on
%First vertical straight line
x3=[1000, 1000];
y3=[1E-9, 1E-6];
loglog(x3,y3)
hold on
%Second vertical straight line
x4=[3000,3000];
y4=[3.5E-7,1E-9];
loglog(x4,y4)
hold on
%Horizontal straight line
x5=[1,5000];
y5=[3.98E-7,3.98E-7];
loglog(x5,y5)
%Find intersection point
[xi,yi]=polyxpoly(x1,y1,x5,y5)
mapshow(xi,yi,'DisplayType','point','Marker','o')
Accepted Answer
More Answers (0)
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!