%% Sample Points for Moving Standard Deviation
% Compute a 3-hour centered moving standard deviation of the data in A according to the time vector t.

A = [4 8 6 -1 -2 -3];
k = hours(3);
t = datetime(2016,1,1,0,0,0) + hours(0:5)

%

M = movstd(A,k,'SamplePoints',t)

% Copyright 2012 The MathWorks, Inc.