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

조회 수: 2 (최근 30일)
Rishi Kiran Shankar
Rishi Kiran Shankar 2019년 7월 8일
댓글: Bjorn Gustavsson 2019년 7월 8일
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