필터 지우기
필터 지우기

How to interpolate data as stairs

조회 수: 5 (최근 30일)
Paul
Paul 2024년 6월 6일
답변: Star Strider 2024년 6월 6일
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
Deepak Gupta
Deepak Gupta 2024년 6월 6일
I think you are directly using plot function on your data, instead you can use stairs function to plot staircase like plot.

댓글을 달려면 로그인하십시오.

답변 (1개)

Star Strider
Star Strider 2024년 6월 6일
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.

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by