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

    %% Compute the Mean and Running Mean of a Signal

%%
% *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).

%% Mean
hmean1 = dsp.Mean;
x = randn(100,1);
y = hmean1(x);

%% Running Mean
hmean2 = dsp.Mean;
hmean2.RunningMean = true;
x = randn(100,1);
yrmean = hmean2(x);