Make unequally spaced data x,y equally spaced

39 ビュー (過去 30 日間)
Eugenio Daviso
Eugenio Daviso 2017 年 3 月 21 日
回答済み: Tamas Kis 2021 年 7 月 25 日
Hi all,
I have this issue: I have x and y data where x that is unequally spaced, for example:
x=[99.5,100,100.5,101,104,106,108,110,112,116,120,124,128] and y=[does not matter]
Is there a transformation I can use to have x equally spaced with the smallest step (0.5 in this case) and y being smoothed (monotonically increasing or decreasing) in between the newly added points?
Thanks

採用された回答

Guillaume
Guillaume 2017 年 3 月 21 日
newx = x(1):min(diff(x)):x(end);
newy = interp1(x, y, newx);
  1 件のコメント
Eugenio Daviso
Eugenio Daviso 2017 年 3 月 21 日
Thank you!

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

その他の回答 (1 件)

Community Treasure Hunt

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

Start Hunting!

Translated by