converting irregular space data into regular spaced data for time line interpolation

HI i was given a dataset that has irregular spaced time and temperature.I am now struggling to do a time series linear interpolation since i dont know how to create a regularly spaced on hour time series from the data given. for example vq = interp1(x,v,xq,method,extrapolation);
i have the values for x and v but not xq. so how do i get the regular spaced data?
%%load data
A = load('../data2/Q1_data.txt');
B = load('../data2/Q2_data.txt');
C = load('../data2/Q3_data.txt');
D = load('../data2/Q4_data.txt');
%%Question 1 interpolation
a_date = (A(:,1));
a_temp = (A(:,2));
a_hourly = ?
A_linear = interp1(a_date, a_temp, min(a_hourly):max(a_hourly), 'linear', 'extrap');

 Réponse acceptée

I'm not entirely clear what your question is. If you want to retime some sampled data, the easiest is to use a timetable.
This could be as simple as:
tt = table2timetable(readtable('../data2/Q1_data.txt'));
tt = retime(tt, 'hourly');
Note: never create sequential variable names (such as your A, B, C, D). These should go in a single matrix or cell array instead.

Plus de réponses (0)

Catégories

En savoir plus sur Interpolation dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by