How to make 2 data sets the same size
Ältere Kommentare anzeigen
Hello,
I have two data sets (Temperature over Time and Absorption over Time) over the same time interval. The problem is that one set has 6000 values(~10 per second) and the other one 900(~1.5 per second). I would like to cut down both sets to the same size, by taking the average value for each second, but I am not sure how to do this. The function I am writing is getting rather convoluted and confusing with several nested loops, so I am wondering if there is some easy way to do this that I am overlooking.
Thanks in advance for any help, Angela
1 Kommentar
Angela
am 18 Jun. 2014
Akzeptierte Antwort
Weitere Antworten (1)
Andrei Bobrov
am 17 Jun. 2014
x1 = randi(500,6000,1); % your data
x2 = randi(600,900,1); %
Fx1 = griddedInterpolant(x1);
Fx2 = griddedInterpolant(x2);
out = [Fx1(linspace(1,numel(x1),600)'), Fx2(linspace(1,numel(x2),600)')];
1 Kommentar
Madina Makhmutova
am 22 Feb. 2019
Bearbeitet: Madina Makhmutova
am 22 Feb. 2019
Dear Andrei,
How can I adjust this code without using for loops if instead of being a vector x1 is a matrix?
x1 = randi(500,6000,5);
Thank you.
Kategorien
Mehr zu Multirate Signal Processing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!