Plotting triangle and finding its vertices
조회 수: 2 (최근 30일)
이전 댓글 표시
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);
댓글 수: 0
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!