Plotting triangle and finding its vertices

1 view (last 30 days)
Emmanuel
Emmanuel on 30 May 2014
hi!! I want to plot these lines, find the point of intersection formed by these lines. The plot is not intersecting these, though they should graphically. How do I make them intersect and find the vertices formed?
[x1] = input('Enter the value of 1st coord');
[y1] = input('Enter the value of 2nd coord');
t = linspace(0,1);
xa = x1(1)+ (y1(1)-x1(1))*t;
ya = y1(1) + (y1(2)-x1(2))*t;
[x2] = input('Enter the value of 1st coord');
[y2] = input('Enter the value of 1st coord');
u = linspace(0,1);
xb = x2(1)+ (y2(1)-x2(1))*u;
yb = y2(1) + (y2(2)-x2(2))*u;
[x3] = input('Enter the value of 1st coord');
[y3] = input('Enter the value of 1st coord');
v = linspace(0,1);
xc = x3(1)+(y3(1)-x3(1))*v;
yc = y3(1)+(y3(2)-x3(2))*v;
plot(xa,ya,xb,yb,xc,yc);

Answers (0)

Categories

Find more on 2-D and 3-D 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!