文档

Sgolayfilt

Savitzky-Golay过滤

句法

y = sgolayfilt(x,订单,弗拉梅伦)
y = sgolayfilt(x,order,framelen,重量)
y = sgolayfilt(x,order,framelen,重量,昏暗)

描述

y = sgolayfilt(x,订单,弗拉梅伦)applies a Savitzky-Golay FIR smoothing filter to the data in vectorX。如果X是矩阵,Sgolayfilt在每一列上操作。多项式秩序,命令,必须小于框架长度,弗拉梅伦,然后弗拉梅伦must be odd. If命令=弗拉梅伦-1,过滤器不会产生平滑。

y = sgolayfilt(x,order,framelen,重量)specifies a weighting vector,权重,,,,with length弗拉梅伦,其中包含在最小二乘最小化过程中要使用的真实,积分的权重。如果权重未指定,或者如果将其指定为空,[],它默认为身份矩阵。

y = sgolayfilt(x,order,framelen,重量,昏暗)指定维度,暗淡,过滤器运行。如果暗淡未指定,Sgolayfilt沿着第一个nonsingleton维度运行;也就是说,对于列向量和非平凡矩阵的维度1,而行向量的尺寸2。

例子

全部收缩

生成随机信号并使用Sgolayfilt。指定3和帧长度为11的多项式顺序。绘制原始信号和平滑信号。

订单= 3;Framelen = 11;lx = 34;x = randn(lx,1);sgf = sgolayfilt(x,order,framelen);情节(x,':')holdon情节(sgf,'.-') 传奇('signal',,,,'sgolay'

Sgolayfilt功能通过将信号与中心行进行卷积来执行大部分过滤b,输出Sgolay。结果是过滤信号的稳态部分。生成并绘制此部分。

M =(Framelen-1)/2;b = sgolay(订单,弗拉梅伦);stestend = conv(x,b(m+1,:),,'same');情节(稳定)传奇('signal',,,,'sgolay',,,,'稳定的'

接近信号边缘的样品不能放置在对称窗口的中心,必须以不同的方式处理。

要确定启动瞬态,矩阵乘以第一个(Framelen-1)/2rows ofb第一个弗拉梅伦信号的样本。

ybeg = B(1:m,:)*x(1:framelen);

To determine the terminal transient, matrix multiply the final(Framelen-1)/2rows ofb到决赛弗拉梅伦信号的样本。

yend = B(framelen-m+1:framelen,:)*x(lx-framelen+1:lx);

加入瞬态和稳态部分以生成完整的信号。

cmplt =稳定;cmplt(1:m)= ybeg;cmplt(lx-m+1:lx)= yend;情节(cmplt)传奇('signal',,,,'sgolay',,,,'稳定的',,,,'完全的')hold离开

最小化的权重打破了对称性的对称性b并需要额外的步骤来制定适当的解决方案。

平滑MTLB通过将立方Savitzky-Golay过滤器应用于长度41的数据帧来发出信号。

加载MTLBsmtlb = sgolayfilt(MTLB,3,41);子图(2,1,1)图(1:2000,MTLB(1:2000))轴([0 2000 -4 4])标题('mtlb') 网格subplot(2,1,2) plot(1:2000,smtlb(1:2000)) axis([0 2000 -4 4]) title('smtlb') 网格

提示

Savitzky-Golay smoothing filters (also called digital smoothing polynomial filters or least-squares smoothing filters) are typically used to “smooth out” a noisy signal whose frequency span (without noise) is large. In this type of application, Savitzky-Golay smoothing filters perform much better than standard averaging FIR filters, which tend to filter out a significant portion of the signal's high frequency content along with the noise. Although Savitzky-Golay filters are more effective at preserving the pertinent high frequency components of the signal, they are less successful than standard averaging FIR filters at rejecting noise.

Savitzky-Golay滤波器在将多项式拟合到嘈杂数据框架时最小二乘错误的意义是最佳的。

References

[1] Orfanidis,Sophocles J.信号处理简介。新泽西州Englewood Cliffs:Prentice-Hall,1996年。

扩展功能

C/C ++代码生成
使用MATLAB®CODER™生成C和C ++代码。

也可以看看

|||

之前介绍过的R2006a

这个话题有帮助吗?