For many vectors of data of different length, how do I interpolate to set them all to have the same length?
19 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Blenndrman
am 3 Sep. 2019
Bearbeitet: Adam Danz
am 4 Sep. 2019
I'm analyzing a series of data vectors, each of which has a different number of points, but the x-coordinate of the data spans 1 to ~2800. My simulations have 1400 points, so I need to interpolate the data vectors to properly sample the y-coordinate of the data while ending up with all interpolated data vectors at a length of 1400. Are there any helpful tricks? I know "resample()" would do the trick, but I'm not able to purchase the signal processing toolbox, so that's not an option.
0 Kommentare
Akzeptierte Antwort
Adam Danz
am 3 Sep. 2019
Bearbeitet: Adam Danz
am 3 Sep. 2019
Use interp1()
Demo:
xdata = 1:280;
ydata = 10:150;
xdataResamp = linspace(xdata(1),xdata(end),numel(ydata));
ydataInterp = interp1(xdataResamp,ydata,xdata);
% Visually inspect results
figure()
plot(xdataResamp,ydata, 'b-o')
hold on
plot(xdata, ydataInterp, 'r-s')
4 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Multirate Signal Processing 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!