How to plot a discrete time series object as stairs?

3 ビュー (過去 30 日間)
Sören
Sören 2015 年 5 月 6 日
回答済み: Violaine Dalmas 2023 年 5 月 12 日
Hello,
I have a time series object which contains discrete data.
Now I want to plot this data as a stairstep graph.
The usual functions "stairs" and "datetick" do not work for me, since I want the detailed time stamp on the x-axis, even when I zoom into the graph.
Thank you very much for your help!
Sören
  1 件のコメント
KL
KL 2015 年 5 月 6 日
can you provide a short example of your data and output expectations?

サインインしてコメントする。

回答 (1 件)

Violaine Dalmas
Violaine Dalmas 2023 年 5 月 12 日
Old question, but I think I've had the same one. Plot with timeseries is done by default with interpolation. To get a stairstep graph, you can change the interpmethod of the timeseries ts:
ts_stairs = setinterpmethod(ts,'zoh') ;
And then use standard command plot: plot(ts_stairs).

カテゴリ

Help Center および File ExchangeTime Series についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by