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

10 次查看(过去 30 天)
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.

采纳的回答

Walter Roberson
Walter Roberson 2021-1-31
%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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interpolation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by