NaN Tolerant Fast Smooth

Smoothes Time series data even if it contains NaNs, using fast algorithm
2,9K download
Aggiornato 5 ott 2015

Visualizza la licenza

nanfastsmooth is a function of the form y = fastsmooth(x,w,type,tol) where y becomes a smoothed version of x using a moving average function of width w where NaNs in the data are ignored.
The argument "type" determines the smooth type:
If type=1, rectangular (sliding-average or boxcar)
If type=2, triangular (2 passes of sliding-average)
If type=3, pseudo-Gaussian (3 passes of sliding-average)
The argument "tol" controls the amount of tolerance to NaNs allowed between 0and 1. A value of zero means that if the window has any NaNs in it then the output is set as NaN. A value of 1 allows any number of NaNs in the window and will still give an answer for the smoothed signal. A value of 0.5 means that there must be at least half real values in the window for the output to be valid.
The start and end of the file are treated as if there are NaNs beyond the dataset. As such the behaviour depends on the value of 'tol' as described above. With 'tol' set at 0.5 the smoothed signal will start and end at the same time as the orgional signal. However it's accuracy will be reduced and the moving average will become more and more one-sided as the beginning and end is approached.

fastsmooth(Y,w,type) smooths with tol = 0.5.
fastsmooth(Y,w) smooths with type = 1 and tol = 0.5

Written using Matlab 2013b but should work with older releases

This file is heavily based on the fastsmooth function by T. C. O'Haver, May, 2008.

Cita come

Greg Pittam (2024). NaN Tolerant Fast Smooth (https://www.mathworks.com/matlabcentral/fileexchange/52688-nan-tolerant-fast-smooth), MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R2013b
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Riconoscimenti

Ispirato da: Fast smoothing function

Community Treasure Hunt

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

Start Hunting!
Versione Pubblicato Note della release
1.1.0.0

Updated to Version 1.1, 5th October 2015. G.M.Pittam
- Updated to correctly smooth both even and uneven window lengths.
- Removes phase shift issue
- Issue identified by Erik Benkler 5th September 2015.

1.0.0.0