How to increase elements of a vector, of different size, without changing its plot?
4 views (last 30 days)
Show older comments
Licarion Pinto
on 11 Nov 2019
Answered: Licarion Pinto
on 13 Nov 2019
I have several matriz (sample) of diferente size. Each matriz contain 2 columns.The first column contains the axis (labels) indicating the range and the resolution and the second column the data. The recorded axis are different for each matriz (sample) and i need to synchronize this data.
Is it possible to do it? I tried to use interp1 but without success.
The data for 2 samples is attached.
1 Comment
Akira Agata
on 12 Nov 2019
Question is not clear for me...
Looking at your data, both 1st and 2nd column are numeric. By simply plotting the data, the following plot was obtained.
You mean, you want to apply "resampling" for both a and b with the same sampling timing?
Accepted Answer
Akira Agata
on 13 Nov 2019
OK.
Then, I would recommend converting your data into timetable, and applying synchronize and/or retime function.
The following is an example.
% Load your data
load('data.mat');
% Create timetable by assuming 1st column is time in [s]
Time = seconds(a(:,1));
A = a(:,2);
ttA = timetable(Time,A);
Time = seconds(b(:,1));
B = b(:,2);
ttB = timetable(Time,B);
% Synchronize these two data
ttAll = synchronize(ttA,ttB);
% Fillign NaN by applying interpolation, if needed
ttAll = fillmissing(ttAll,'linear');
0 Comments
More Answers (2)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!