Adjust measurement data with different vector lengths using interpolation
Show older comments
I have carried out various series of measurements from which I would like to form arithmetic mean values.
The problem is that one series of measurements has 1200 data points (Vector_1), the second only 1000 (Vector_2) and the third 800 data points (Vector_3).
I tried to adapt this to the largest vector using interpolation:
maxLength = max([length(Vector_1), length(Vector_2), length(Vector_2)]);
xFit = 1:maxLength;
IP_Vector_1 = interp1(1:length(Vector_1), Vector_1, xFit);
IP_Vector_2 = interp1(1:length(Vector_2), Vector_2, xFit);
IP_Vector_3 = interp1(1:length(Vector_3), Vector_3, xFit);
However, this code does not seem to distribute the interpolation evenly, but rather puts it at the end (with NaN). Does anyone have any idea what the problem is or have another suggestion how that could be solved elegantly in Matlab?
Many Thanks!
2 Comments
David Hill
on 26 Jan 2021
Do you just want the mean of all your data? I don't understand your question.
mean([Vector1,Vector_2,Vector_3]);
Mepe
on 26 Jan 2021
Accepted Answer
More Answers (0)
Categories
Find more on Large Files and Big Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!