How to synchronise two time series data with different sampling time in MATLAB?
조회 수: 16 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Mathieu NOE
2021년 10월 4일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!