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.
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!