5.0

5.0 | 4 ratings Rate this file 122 downloads (last 30 days) File Size: 3.57 KB File ID: #5536

SAVFILT

by Vassili Pastushenko

 

21 Jul 2004 (Updated 27 Jul 2004)

No BSD License  

Generalization and improvement of SGOLAYFILT(Dat,1,Frame).

Download Now | Watch this File

File Information
Description

Program: SAVFILT

Simply AVeraging FILTer for vectors or matrices (works on columns of matrices)

Description: generalized and improved version of SGOLAYFILT(Dat,1,W)

In practice SGOLAYFILT is most frequently used with ORDer 1, because at given filtering frame W the ORDer 1 gives the highest smoothening of the Data. Advantages of SAVFILT(Dat,W) in comparison to SGOLAYFILT(Dat,1,W):

1. Better results at the rands of the Data: instead of arbitrary padding the Data with zeros, a possibly wide frame is used at the rands.
2. SAVFILT accepts arbitrary frames W>1, not only odd ones, as SGOLAYFILT does. The results of filtering white noise with any W>1 leads to almost by the factor of sqrt(W) smaller standard deviation of the filtered data in comparison to raw data. This feature is especially helpful in the case of filtering periodical data with an arbitrary period.
3. With odd W SAVFILT works more than 2 times faster than SGOLAYFILT, and about at the same speed in the case of nonodd W (can be made equally fast and with exact efficiency sqrt(W)). The Efficiency of any low-pass filter is defined as: E=std(Dat)/std(DatF), Dat being white gaussian noise and DatF is filtered Dat Call:
DatF=savfilt(Dat,W,E)

Input:
Dat = Data to be filtered, a matrix N*M, any([N,M]>1)
E= filter efficiency, abs(E)>1
W= abs(E)^2
% W or E are used interchangeably. If nargin>2, W-value will be replaced by W=abs(E^2)

Output:
DatF = Filtered Data

V.Pastushenko, 22-nd July 1993, J.Kepler Univ. of Linz, Austria

Acknowledgements
This submission has inspired the following:
fSGolayFilt
MATLAB release MATLAB 6.1 (R12.1)
Other requirements None
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (5)
14 Aug 2004 Jianwen Luo

Very Good!

14 Aug 2004 Jianwen Luo

Very Good.

18 Sep 2004 N/A N/A

I like Savitzky-Golay filter for smoothing and differentiation.

05 Oct 2004 Ferry Kienberger

Worked very well indeed!

20 Sep 2009 Jan Simon

You can accelerate the processing by ~30%, if you replace the lines:
  81: BEGIN=DatF(1:2:W,:);
  ...
  95: DatF=DatF.*WEIG;
with:
  w1 = transpose(1:2:W);
  iw1 = 1 ./ w1;
  iw1C = iw1(:, ones(1, C));
  BEGIN = DatF(w1, :);
  ENDIN = cumsum(Dat(R:-1:R-W+1, :));
  DatF(HW+2:R-HW-1, :) = (DatF(W+1:R-1, :) -
         DatF(1:R-W-1, :)) .* (1 / W);
  DatF(1:HW+1, :) = BEGIN .* iw1C;
  DatF(R:-1:R-HW, :) = ENDIN(w1, :) .* iw1C;
Kind regards, Jan

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
filter design Vassili Pastushenko 22 Oct 2008 07:28:05
filter analysis Vassili Pastushenko 22 Oct 2008 07:28:05
sgolayfilt Vassili Pastushenko 22 Oct 2008 07:28:05
lowpass Vassili Pastushenko 22 Oct 2008 07:28:05
filter Vassili Pastushenko 22 Oct 2008 07:28:05
odd Vassili Pastushenko 22 Oct 2008 07:28:05
frame Vassili Pastushenko 22 Oct 2008 07:28:05
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com