MATLAB Answers

How can I improve this plot?

6 ビュー (過去 30 日間)
Tommaso Belluzzo
Tommaso Belluzzo 2020 年 3 月 8 日
コメント済み: Star Strider 2020 年 3 月 8 日
Hi all! I'm asking a little but of support for solving a small issue concerning the following plot:
I would like to improve its readability because for large time spans, all you can see are small spikes of non-zero data basically. Which is absolutely correct, but hard to interpret.
I tried to use 30 days or 60 days movmean (over a total time span of 15 years) to smooth the underlying data being plotted, but unfortunately the obtained result, despite the readability improvement, wasn't so great. All the other smoothing functions I tried completely messed up the plot, which must represent a zero-inflated value.
I was looking for a good solution half-way between a movmean and raw data. Something that can preserve the original magnitude and spikes, providing a visual improvement of the "trend". A sort of interpolation over high and low spikes of data. Something like this (sorry, I'm really bad at drawing):
Can you suggest me a way to obtain that?
I attached the test data I'm using to produce the plot above.

  0 件のコメント



Star Strider
Star Strider 2020 年 3 月 8 日
That looks like something the envelope function would return.

  2 件のコメント

Tommaso Belluzzo
Tommaso Belluzzo 2020 年 3 月 8 日
Yes... we are on the good path here. Absolutely.
I tried using peak envelope, it's good but there are two major problems for now: finding a generalized value for peaks separation and placing a constraint so that envelope cannot go below zero.
Star Strider
Star Strider 2020 年 3 月 8 日
I am not certain that there is any way to constrain it, although it has a number of parameters (for example 'peak') that you might be able to manipulate to get an acceptable result.
The only other option I can suggest is the sgolayfilt function. It has a few more options, although I am not certain that it can be constrained to remain positive.


その他の回答 (0 件)



Community Treasure Hunt

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

Start Hunting!

Translated by