From ControlTheoryPro.com

Contents 
1 Introduction to Low Pass Filters
Filtering is extremely useful when creating a real world systems. Often times real systems have inconvenient modes that can be reduced with bandpass filtering. Sometimes sensors get noisy in higher frequencies and when teh system doesn't require those higher frequencies it is usually best to use a low pass filter to reduce the effect of the high frequency noise.
For example, if you are using a gyro on earth and that gyro can measured a low enough frequency then it will measure the Earth's rotation. A low pass filter is used to eliminate the Earth's rotational rate.
2 Construction of a Low Pass Filter
Construction of a low pass filter using the tf command is simple. (The tf command requires the Controls toolbox.)
2.1 1^{st} Order Low Pass Filter
The transfer function of a first order low pass filter is
The in the numerator is how the low pass filter maintain a unity gain at DC. A first order low pass filter is easily created in MATLAB with the following commands
>> w = 1; >> lpf_1st = tf([w], [1, w]);
This will create a low pass filter with a corner frequency at w = 1 rad/sec. The magnitude rolloff will be 20 dB/decade with a phase change of 90 degrees near w.
2.2 2^{nd} Order Low Pass Filter
The transfer function for a second order low pass filter is
A second order low pass filter is easily created in MATLAB with the following commands
>> w = 1; >> z = 1/sqrt(2); >> lpf_2nd = tf([w^2], [1, 2*z*w, w^2]);
This will create a second order low pass filter in the standard second order system form. The z of will create a low pass filter with no peaking. The magnitude rolloff will be 40 dB/decade with a phase change of 180 degrees near w.
3 See Also
4 MATLAB Related Books