# Reduce data points from 200 to 108

111 ビュー (過去 30 日間)
Maxwell Barton 2019 年 11 月 21 日
コメント済み: Daniel M 2019 年 11 月 21 日
I have a data series with 200 data points and I need to compress this information to 108 data points. I don't think I can use a moving average filter as the window wouldn't be an integer so is there a way in MATLAB to do this?

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

### 採用された回答

Star Strider 2019 年 11 月 21 日
I have no idea what your data are or what you want to do with them, other than reduce the number of them.
Interpolating them to a shorter independent variable vector may be an option. See if the interp1 function can do what you want. The linspace function can be helpful in providing the new independent variable vector.
##### 3 件のコメント1 件の古いコメントを表示1 件の古いコメントを非表示
Maxwell Barton 2019 年 11 月 21 日
Thanks resampling is what I was looking for!
Star Strider 2019 年 11 月 21 日
As always, my pleasure!

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

### その他の回答 (1 件)

Daniel M 2019 年 11 月 21 日

Do you want to:
2. downsample or resample
3. interpolate
4. something else?
Truncate example:
t = 1:200;
x = rand(1,200);
x2 = x(1:108);
##### 2 件のコメントなしを表示なしを非表示
Maxwell Barton 2019 年 11 月 21 日
Truncation wouldn't work unfortunately. How would I downsample with a non integer rate (200/108 = 1.8519)?
And how would interpolation work; it wouldn't work as below.
time_1= 1:200
time_2 = 1:108
interp1(time,data_1,time_2)
Daniel M 2019 年 11 月 21 日
That's what resampling function is for. Star Strider has responded under his answer.

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

### カテゴリ

Help Center および File ExchangeMultirate Signal Processing についてさらに検索

R2018a

### Community Treasure Hunt

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

Start Hunting!

Translated by