filter
1-D digital filter
Syntax
y = filter(b,a,x)
y = filter(b,a,x,zi)
y = filter(b,a,x,zi,dim)
[y,zf] = filter(___)
Description
y = filter(b,a,x) 使用由分子和分母系数 b 和 a 定义的有理传递函数对输入数据 x 进行滤波。
If a(1) is not equal to 1, then filter normalizes the filter coefficients by a(1). Therefore, a(1) must be nonzero.
If x is a vector, then filter returns the filtered data as a vector of the same size as x.
If x is a matrix, then filter acts along the first dimension and returns the filtered data for each column.
If x is a multidimensional array, then filter acts along the first array dimension whose size does not equal 1.
针对这条语法举个例子:
Moving-Average Filter
移动平均滤波器是用于平滑噪声数据的常用方法。 此示例使用过滤器函数计算沿数据向量的平均值。
Create a 1-by-100 row vector of sinusoidal data that is corrupted by random noise.
t = linspace(-pi,pi,100);
rng default %initialize random number generator
x = sin(t) + 0.25*rand(size(t));
A moving-average filter slides a window of length windowSize along the data, computing averages of the data contained in each window. The following difference equation defines a moving-average filter of a vector