MATLAB: How to smooth datetime type of array?

datetime

i have request and response time od mobile users and want to calculate the elapsed time for that i need to smooth the the time.i have tried moving avg smoother its not working as it is Datetime

Best Answer

Let D be your datetime array. Then
D_diff_dur = diff(D);
diff_days = datenum(D_diff);
smooth_diff_days = smooth(diff_days);
smooth_diff_dur = days(smooth_diff_days);
smoothed_D = D(1) + smooth_diff_dur;
This can all be combined into one expression.