I have polygon as shown in Fig1. I also know the coordinates of the vertices. I now want to use those vertices to create a serie of lines that reproduce the same polygon. I have the following code, but can't reproduce the initial figure (see Fig2). I know the "patch" function can be used but it doesn't serve my goal.
clear all
Vertex_X=[30;43;49;45;22;19;30;43;89;28;30;28;0;19;54;45;49;89;54;89;96;66];
Vertex_Y=[38;40;55;69;66;41;38;40;0;16;38;16;19;41;86;69;55;44;86;44;40;100];
for i=1:(length(Vertex_X)-1)
X1(i)=Vertex_X(i);
Y1(i)=Vertex_Y(i);
X2(i)=Vertex_X(i+1);
Y2(i)=Vertex_Y(i+1);
end
A=[X1 Y1];
B=[X2 Y2];
plot(A.',B.','LineWidth', 0.75)
2 Comments
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/595738-drawing-polygon-from-lines#comment_1013842
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/595738-drawing-polygon-from-lines#comment_1013842
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/595738-drawing-polygon-from-lines#comment_1013857
Direct link to this comment
https://es.mathworks.com/matlabcentral/answers/595738-drawing-polygon-from-lines#comment_1013857
Sign in to comment.