Borrar filtros
Borrar filtros

How to discretize non-uniformally a curve

1 visualización (últimos 30 días)
Christos Patrinos
Christos Patrinos el 6 de Sept. de 2021
Comentada: Star Strider el 6 de Sept. de 2021
Hello,
Let's assume I have the following curves (see smooth solid lines) and I want to discretize them. I know about the discretize function, but what I would want is to discretize them using variable steps (see lines in discretized pattern). I know the easiest way is to manually discretize them by putting all the points hard coded and generating the pattern, but my main question is if there is an automated way through which I could input the reference curve, the number of points and their respective durations and have the curves created automatically.
Many thanks.

Respuesta aceptada

Star Strider
Star Strider el 6 de Sept. de 2021
One option is the stairs function —
x = linspace(0, 400,50);
y = [exp(x/100); sin(x/100)-x/400];
figure
plot(x, y)
grid
figure
stairs(x, y(1,:))
[xb{1}, yb{1}] = stairs(x, y(1,:));
hold on
stairs(x, y(2,:))
[xb{2}, yb{2}] = stairs(x, y(2,:));
hold off
grid
GetData= [xb{1}(1:10) yb{1}(1:10)]
GetData = 10×2
0 1.0000 8.1633 1.0000 8.1633 1.0851 16.3265 1.0851 16.3265 1.1773 24.4898 1.1773 24.4898 1.2775 32.6531 1.2775 32.6531 1.3862 40.8163 1.3862
Experiment to get different results.
.
  2 comentarios
Christos Patrinos
Christos Patrinos el 6 de Sept. de 2021
Thank you for your answer @Star Strider; I think it is a good starting point!
Star Strider
Star Strider el 6 de Sept. de 2021
As always, my pleasure!
.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Elementary Math en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by