フィルターのクリア

Linear Interpolate to n equally spaced points

22 ビュー (過去 30 日間)
kevin
kevin 2015 年 10 月 20 日
コメント済み: kevin 2015 年 10 月 20 日
I have two sets of coordinate data. The rates of the two are different. I would like to linearly interpolate one tot he same length as the other. I have tried various methods of interp1 but can't seem to get what I need. An quick example would be
in_vector =[0 5 10 5 0].
Need 15 samples of this data.
out_vector = interp(in_vector, 15)
and produces and output of
[0, 1.42857, 2.85714, 4.28571, 5.71429, 7.14286, 8.57143, 10.0000,
8.57143, 7.14286, 5.71429, 4.28571, 2.85714, 1.42857, 0].
Basically what interpft but linear and not FFT.

採用された回答

dpb
dpb 2015 年 10 月 20 日
編集済み: dpb 2015 年 10 月 20 日
doc interp1
>> v=[0 5 10 5 0]; L=length(v);
>> interp1(1:L,v,linspace(1,L,15))
ans =
Columns 1 through 10
0 1.4286 2.8571 4.2857 5.7143 7.1429 8.5714 10.0000 8.5714 7.1429
Columns 11 through 15
5.7143 4.2857 2.8571 1.4286 0
>>
  1 件のコメント
kevin
kevin 2015 年 10 月 20 日
I was so close! linspace was what I was missing. Thanks!

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by