Sample data from time-dependent array

2 views (last 30 days)
Hi, apologies as I am somewhat new to Matlab.
I have two columns of data in a matrix (time, and an array of temperature data). The data is irregularly spaced in time.
For example (time on left and temp on right):
228.0000 23.7800
236.0000 23.8767
244.0000 23.9400
256.0000 24.1400
268.0000 23.8200
276.0000 24.0700
Using this time-dependent data, I'd like to predict temperature values for a new time array. The new time array is different from the first in that there are repeat times (i.e., 236.0000 below), and new times that did not exist in the first (i.e., 246.0000 below).
For example:
228.0000 ?
236.0000 ?
236.0000 ?
236.0000 ?
244.0000 ?
246.0000 ?
256.0000 ?
268.0000 ?
276.0000 ?
Thanks for the patience and help!

Accepted Answer

Andrei Bobrov
Andrei Bobrov on 16 Sep 2019
data = [ 228.0000 23.7800
236.0000 23.8767
244.0000 23.9400
256.0000 24.1400
268.0000 23.8200
276.0000 24.0700];
data2 = [ 228.0000
236.0000
236.0000
236.0000
244.0000
246.0000
256.0000
268.0000
276.0000 ];
out = interp1(data(:,1),data(:,2),data2);

More Answers (0)

Categories

Find more on Time Series in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!