Make unequally spaced data x,y equally spaced

36 Ansichten (letzte 30 Tage)
Eugenio Daviso
Eugenio Daviso am 21 Mär. 2017
Beantwortet: Tamas Kis am 25 Jul. 2021
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

Akzeptierte Antwort

Guillaume
Guillaume am 21 Mär. 2017
newx = x(1):min(diff(x)):x(end);
newy = interp1(x, y, newx);

Weitere Antworten (1)

Tamas Kis
Tamas Kis am 25 Jul. 2021

Kategorien

Mehr zu Time Series finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by