# How to synchronise two time series data with different sampling time in MATLAB?

15 vues (au cours des 30 derniers jours)
Arshey Dhangekar le 2 Oct 2021
Commenté : Mathieu NOE le 5 Nov 2021
There are two sensor measured power and temperature and they have 4 mintutes sampling time difference. I want to synchronise time of power and temperature sensor data. How can I synchrnoise in csv data file? it because around 9440 obeservation the time difference between two devices become 10 minutes which created problem graph plotted. how can I use interp1 to sychnronise two different time data?
interp1(x,v,xq)
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponses (1)

Mathieu NOE le 4 Oct 2021
hello
see my suggeston below
the new common time vector is sampled with only N = 100 here , but you can adjust this to your own needs
clc
clearvars
T =readtable('sample file.xlsx','Format','auto');% Sr no_Temperature_sensor Sr no_Power_sensor Time_Temperature_sensor Time_Power_sensor
Time_Temperature_sensor = str2double(T.Time_Temperature_sensor);
Time_Power_sensor = str2double (T.Time_Power_sensor);
Temperature_sensor = T.SrNo_Temperature_sensor;
Power_sensor = T.SrNo_Power_sensor;
% common time vector
common_time_min = max(min(Time_Temperature_sensor),min(Time_Power_sensor));
common_time_max = min(max(Time_Temperature_sensor),max(Time_Power_sensor));
N = 100;
common_time_vector = linspace(common_time_min,common_time_max,N);
% interpolate both data sets on common time vector
Temperature_sensor2 = interp1(Time_Temperature_sensor,Temperature_sensor,common_time_vector);
Power_sensor2 = interp1(Time_Power_sensor,Power_sensor,common_time_vector);
figure
plot(common_time_vector,Temperature_sensor2,common_time_vector,Power_sensor2);
##### 3 commentairesAfficher 1 commentaire plus ancienMasquer 1 commentaire plus ancien
Mathieu NOE le 25 Oct 2021
hello again
problem solved ?
Mathieu NOE le 5 Nov 2021
hello
do you mind accepting my answer ?
tx

Connectez-vous pour commenter.

### Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

R2021a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by