Azzera filtri
Azzera filtri

How to converter the hourly data interval to 15-minutes interval using interpolate function of matlab?

7 visualizzazioni (ultimi 30 giorni)
I have one year temperature with hourly interval and I want to make it to 15 minutes interval. I try to use interpolate function of matlab but I wasn't able to do it sucessfully. Therefore Kindly help me to solve this issue.

Risposta accettata

Walter Roberson
Walter Roberson il 31 Gen 2021
%when interp1 is strictly required:
%assuming uniform times
way2 = interp1(HourlyTemperature, 1:0.25:length(HourlyTemperature)+0.75, 'spline', 'extrap');
%not assuming uniform times
OutTimes = InputTimes(1) + minutes(15)*(0:length(InputTimes)*4-1);
way4 = interp1(InputTimes, HourlyTemperature, OutTimes, 'spline', 'extrap');
%when interp1 is not strictly required
%assuming uniform times, and Signal Processing Toolbox
way1 = resample(HourlyTemperature, 4, 1);
%not assuming uniform times, but with Signal Processing Toolbox
way3 = resample(HourlyTemperature, InputTimes, 1/(15*60)); %1/(15*60) Hz -> 15 minutes apart
%timetable, does not need Signal Processing or uniform times
way5 = retime( timetable(InputTimes(:), HourlyTemperature(:))), minutes(15) );
Decisions have to be made about whether you need the 15, 30, and 45 after the final hour reading; if so then you need extrapolation, and you would need to recheck whether the resample() methods extrapolate.
Watch out for how resample() initializes the buffer, which can affect edge readings.

Più risposte (0)

Categorie

Scopri di più su Interpolation in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by