Borrar filtros
Borrar filtros

How to interpolate data as stairs

5 visualizaciones (últimos 30 días)
Paul
Paul el 6 de Jun. de 2024
Respondida: Star Strider el 6 de Jun. de 2024
I have a struct (lets call it Turbine State) with both time and value data. The issue is there aren't enough data points captured with the range I want, so MATLAB intertpolates the missing data linearly between points.
i.e. shortly beore 14:10 the 'state' is 12 but this should remain 12 until it isn't anymore. so the state should remain 12 before just after 14:30 when it drops to -1. How do i make this a 'stairs' representation and not a liner interpolation?
Thanks :)
  1 comentario
Deepak Gupta
Deepak Gupta el 6 de Jun. de 2024
I think you are directly using plot function on your data, instead you can use stairs function to plot staircase like plot.

Iniciar sesión para comentar.

Respuestas (1)

Star Strider
Star Strider el 6 de Jun. de 2024
You answered your own question — stairs. Note that you can get the (x,y) coordinates as outputs from the stairs function if you wnt to use them with patch or other plots.

Categorías

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

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by