How do I draw lines between all the the existing points.

2 次查看(过去 30 天)
Hi I have points like P1=(x1,y1), P2= (x2,y2) .......Pn= (xn,yn).
I have to draw line between all the points. For instance if we have points P1,P2,P3and P4. I have to draw lines between P1 to P2, P1 to P3, P1 to P4, P2 to P3, P2 to P4 and P3 to P4. Any idea how do i achieve this? I can draw lines using function 'line' but I may get any number of points acording to the user's input and the lines must be drawn between all the existing points.
I have to also mention that each points(P1,P2,....Pn) are stored in a cell.
Any idea would be appreciable.
Thanks in advance.
  1 个评论
Bjorn Gustavsson
Bjorn Gustavsson 2019-7-8
Surely this is a homework/programming task for an introduction to programming course? What have you tried so far? Have you understood how to use loops and how to use nested loops. You know how to plot a line between 2 points with the plot command?
Matlab tip:
hold on

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by