Make unequally spaced data x,y equally spaced

조회 수: 31 (최근 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개)

Tamas Kis
Tamas Kis 2021년 7월 25일

카테고리

Help CenterFile Exchange에서 Time Series에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by