How to converter the hourly data interval to 15-minutes interval using interpolate function of matlab?
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Usman Taya
le 31 Jan 2021
Réponse apportée : Walter Roberson
le 31 Jan 2021
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 commentaires
Réponse acceptée
Walter Roberson
le 31 Jan 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.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Interpolation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!