リサンプリング後も最初(71)と最後(86)は固定したいです
データのリサンプリングについて
4 views (last 30 days)
Show older comments
等間隔ではないデータのリサンプリングを行いたいです。例えば、下記のようなデータ(20個)を13個のデータにするにはどうしたらよいでしょうか。どなたか助言をお願いいたします。(今回は20から13ですが任意の数行いたいです)
71
71.66035
72.64257
73.40705
74.29461
75.0875
75.84253
76.76797
77.58928
78.50525
79.26976
80.09108
80.884
81.64853
82.46986
83.29119
83.92319
84.71614
85.38601
86
Accepted Answer
Shunichi Kusano
on 21 Oct 2021
Edited: Shunichi Kusano
on 21 Oct 2021
そのような不等間隔なxに対して何らか測定値yがある、ということでしょうか?
そういう状況の場合、interp1関数をお使いください。サンプリング点はlinspace関数で作ることができます。
% 参考
% x <= 不等間隔なサンプリング点
% y <= xでの計測値
yq = interp1(x,y,linspace(x(1),x(end),13)); % 内挿
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!