www.gusucode.com > dsp 案例源码程序 matlab代码 > dsp/RunningStandardDeviationExample.m

    %% Running Standard Deviation
%%
% *Note*: This example runs only in R2016b or later. If you are using an
% earlier release, replace each call to the function with the equivalent
% |step| syntax. For example, myObject(x) becomes step(myObject,x).

%%
% Compute the running standard deviation of a signal using
% |dsp.StandardDeviation| object. To activate this mode, set the 
% |RunningStandardDeviation| property to |true|.
 hstd2 = dsp.StandardDeviation;
 hstd2.RunningStandardDeviation = true;
 x = randn(100,1);
 y = hstd2(x); 
 
 %%
 % y(i) is the standard deviation of the ith input sample with respect to
 % all the past input samples.