How to make a softer plot using a moving average every ''x'' skips?

조회 수: 5 (최근 30일)
Guillermo Renderos
Guillermo Renderos 2018년 3월 22일
답변: Chris Turnes 2018년 4월 24일
I have a table from excel from values every 15 minutes from a whole year, the excel table only have 2 columns: DATETIME and VALUE. But when I plot the data, the shape of the plot has a very sharp form. The simplest solutios to make the plot softer, I think, is to calculate the mean for every hour (4 values) and plot them. After searching I found the function tsmovavg, but this function don't do the skip every 4 values, instead of that, can calculate the mean of the last 4 positions of the vector. How can I do to make my script possible?.If you have and example of something very similar to this I would be very greatful to see it.

답변 (2개)

Benjamin Großmann
Benjamin Großmann 2018년 4월 24일
If you have signal processing toolbox than you can use moving average filter or more advanced filtering techniques as described here
If not, than it is also easy to smooth this signal using methods and functions described here e.g.: movemean or smoothdata .

Chris Turnes
Chris Turnes 2018년 4월 24일
It sounds like what you might want to do is put your data into a timetable and use the retime function.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by