How to make a piecewise linear plot from points?

13 views (last 30 days)
My point coordinates are P1(1,1) ,P(3,2), P(3,3), P4(1,4). i need to make a piecewise linear plot i.e. line from P1 to P2, P2 to P3, P3 to P4? How can I do this simply? The number of points might increase.
I want the graph to be similar to the graph attached, the outer piecewise linear plot.

Answers (2)

Matt J
Matt J on 22 Jun 2018
Edited: Matt J on 22 Jun 2018
Just use PLOT, e.g.,
x=[1,3,3,1];
y=[1,2,3,4];
plot(x,y,'o-','MarkerFaceColor','r');

Image Analyst
Image Analyst on 23 Jun 2018
Edited: Image Analyst on 23 Jun 2018
What I think you have is a continuous curve.
What I think you're asking for is called the "minimum perimeter polygon".

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Products


Release

R2017a

Community Treasure Hunt

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

Start Hunting!