Clear Filters
Clear Filters

How can I discretize a smooth curve?

8 views (last 30 days)
Tay
Tay on 7 May 2020
Commented: Stephen23 on 24 Nov 2021
If I have a smooth curve and I want to discretize this curve in some steps how can I do it? I saw some funtion in matlab but is does not work in my curve. See the image below.
  9 Comments
Lazaros Christoforidis
Lazaros Christoforidis on 7 May 2020
np, you could rescale your x, y values

Sign in to comment.

Accepted Answer

Cris LaPierre
Cris LaPierre on 7 May 2020
Try using the discretize function
y=linspace(3.5,3.4965);
x=linspace(0,1000);
plot(x,y)
% discretize
[Y,E] = discretize(y,20);
hold on
plot(x,E(Y),'--r')
hold off
Also, consider looking into the stairstep graph, though that seems to put the steps outside the curve again.
  5 Comments
Tay
Tay on 8 May 2020
Thanks guys !! It's perfectly working !! :D :)

Sign in to comment.

More Answers (0)

Categories

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

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!