savgoln, An N-Dimensional Savitsky Golay Filter

This is a Savitsky-Golay filter that can be used to find smoothen any N-D array (N>1) and also find their partial derivatives.

You are now following this Submission

The Savitsky-Golay filter fits polynomials locally and smoothens/finds the derivative of the signal based on the coefficients of the polynomial. In particular, when there are experimental Fluid Mechanics data such as Velocity Fields from Particle Image Velocimetry (PIV), we deal with scalar fields as a function of (x,y,t) and hence with need 3D SG Filters to remove noise. Some Fields may be a function of (x,y,z,t) and hence may need 4D SG Filters. There may be a few 2D Filters, but could not find any N-D Filters and hence the motivation for this. The filter can smoothen any N-D array at a very high speed as it uses convolutions instead of loops which makes the process about 15000% faster than loops. The function can also find all the partial derivatives depending on the order of polynomial chosen. It is recommended to check the order of kernels (to find which kernel corresponds to which partial derivative) according to their definition in the code for clarity. All the readme/instructions about the syntax and their explanations are given in the .m file. This can be run on cpu's and also on gpus. GPU runs (say, for 3D SG Filter) requires the CUDAConvolution3D function available on CUDAConvolution. For N-dimensionality runs on gpu, the code needs N-dimensional convolution and for gpu processing CUDAConvolution3D needs to be replaced with the appropriate ND function.

Cite As

Vishnu Balaji (2025). savgoln, An N-Dimensional Savitsky Golay Filter (https://www.mathworks.com/matlabcentral/fileexchange/181003), MATLAB Central File Exchange. Retrieved May 4, 2025.

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0.2

Minor Changes. Working of the code is the same.

1.0.1

An issue with references now resolved.

1.0.0