Can I use the movmean function for a time series?

8 ビュー (過去 30 日間)
CivilEngBath
CivilEngBath 2021 年 8 月 25 日
回答済み: Peter Perkins 2021 年 12 月 7 日
I'm trying to use a 5-point running mean for a timeseries. The timeseries has three different data values for every 0.04 seconds. I've tried to find a way to do it but I keep getting an error, what code should I be using? This is the code I've used:
A = movmean(ts,5)

回答 (2 件)

Wan Ji
Wan Ji 2021 年 8 月 25 日
timeseries不支持movmean呢,可以把对其下面的data做操作,比如
ts = timeseries((1:5)',[0 10 20 30 40]);
a = movmean(ts.Data,2);
  3 件のコメント
Wan Ji
Wan Ji 2021 年 8 月 25 日
Sorry,
I should write in English, I mixed two occasions, cause I answered matlab questions on another Chinese platform.
Sincerely
Wan
CivilEngBath
CivilEngBath 2021 年 8 月 25 日
No worries, it was still of great help though!
Best wishes

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


Peter Perkins
Peter Perkins 2021 年 12 月 7 日
CivilEngBath, I recommend that you take a look at using timetables, not timeseries. smoothdata on timetables does what you want. In recent versions of MATLAB, you can convert from timeseries to timetable using the timeseries2timetable function.

カテゴリ

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