This is a MATLAB code of a low pass filter.
Inputting sampling frequency , cut frequency , maximum value of lag, and data, after evaluating the code then you can get the data after passing through the low pass filter(the components whose frequency is higher than the specified cut frequency are all removed) and the coefficients and the transfer function handle of the filter.