Savitzky-Golay smooth/differentiat​ion filters and filter application

版本 1.0.0.0 (5.2 KB) 作者: Diederick
Routine to generate Savitzky-Golay smoothing and differentiation filters and routine to apply these
4.5K 次下载
更新时间 2011/2/4

查看许可证

Contains savitzkyGolay.m and savitzkyGolayFilt.m:
Function:
Savitzky-Golay Smoothing and Differentiation Filter
The Savitzky-Golay smoothing/differentiation filter (i.e., the
polynomial smoothing/differentiation filter, or the least-squares
smoothing/differentiation filters) optimally fit a set of data
points to polynomials of different degrees.
See for details in Matlab Documents (help sgolay). The sgolay
function in Matlab can deal with only symmetrical and uniformly
spaced data of even number.
This function presented here is a general implement of the sgolay
function in Matlab. The Savitzky-Golay filter coefficients for even
number, nonsymmetrical and nonuniformly spaced data can be
obtained. And the filter coefficients for the initial point or the
end point can be obtained too. In addition, either numerical
results or symbolical results can be obtained. Lastly, this
function is faster than MATLAB's sgolay.

Usage:
[fc,df] = savitzkyGolay(x,n,dn,x0,flag)
input:
x = the original data point, e.g., -5:5
n = polynomial order
dn = differentation order (0=smoothing), default=0
x0 = estimation point, can be a vector default=0
W = weight vector, can be empty
must have same length as x0 default=identity
flag = numerical(0) or symbolical(1), default=0

output:
fc = filter coefficients obtained (B output of sgolay).
df = differentiation filters (G output of sgolay).

.

.

savitzkyGolayFilt(X,N,DN,F) filters the signal X using a Savitzky-Golay
(polynomial) filter. The polynomial order, N, must be less than the
frame size, F, and F must be odd. DN specifies the differentiation
order (DN=0 is smoothing). For a DN higher than zero, you'll have to
scale the output by 1/T^DN to acquire the DNth smoothed derivative of
input X, where T is the sampling interval. The length of the input X
must be >= F. If X is a matrix, the filtering is done on the columns
of X.

Note that if the polynomial order N equals F-1, no smoothing
will occur.

savitzkyGolayFilt(X,N,DN,F,W) specifies a weighting vector W with
length F containing real, positive valued weights employed during the
least-squares minimization. If not specified, or if specified as
empty, W defaults to an identity matrix.

savitzkyGolayFilt(X,N,DN,F,[],DIM) or savitzkyGolayFilt(X,N,DN,F,W,DIM)
operates along the dimension DIM.

引用格式

Diederick (2024). Savitzky-Golay smooth/differentiation filters and filter application (https://www.mathworks.com/matlabcentral/fileexchange/30299-savitzky-golay-smooth-differentiation-filters-and-filter-application), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2010b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Smoothing and Denoising 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0