version (5.24 KB) by Carlos Adrian Vargas Aguilera
Low or high-pass Lanczos (cosine) signal filter.


Updated 4 May 2016

View License

Apply the Lanczos filter to a real time series, in the frequency space, i.e., using FFT which is faster than applied as a cosine filter in the time space.
Y = lanczosfilter(X,dT,cf,M,'low')
X - Time series
dT - Sampling interval (default 1)
Cf - Cut-off frequency (default half Nyquist)
M - Number of coefficients (default 100)
and 'low' or 'high' depending if you want to get the smooth or the noisy part of your data, respectively (default 'low', so it smooths).
NaN's elements are replaced by mean(X). If you have a better idea, just let me know.

It comes with an example, also take a look at the screenshot, where the filter is applied to each row.

Emery, W. J. and R. E. Thomson. "Data Analysis Methods in Physical Oceanography". Elsevier, 2d ed., 2004. Pages 533-539.

Cite As

Carlos Adrian Vargas Aguilera (2022). LanczosFilter.m (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14SP3
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!