How to increase elements of a vector, of different size, without changing its plot?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Licarion Pinto
le 11 Nov 2019
Réponse apportée : Licarion Pinto
le 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 commentaire
Akira Agata
le 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?
Réponse acceptée
Akira Agata
le 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 commentaires
Plus de réponses (2)
Voir également
Catégories
En savoir plus sur Functions dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!