Open Rails

IIRFilter.ComputeButterworth Method

[This is preliminary documentation and subject to change.]

First-Order IIR Filter — Calculation by Freescale Semiconductor, Inc. ********************************************************************** In GDFLIB User Reference Manual, 01/2009, Rev.0 Butterworth coefficients calculation The Butterworth first-order low-pass filter prototype is therefore given as: w_c H(s) = --------- s + w_c This is a transfer function of Butterworth low-pass filter in the s-domain with the cutoff frequency given by the w_c Transformation of an analog filter described by previous equation into a discrete form is done using the bilinear transformation, resulting in the following transfer function: w_cd*Ts w_cd*Ts -1 -------------- + ------------ * z 2 + w_cd*Ts 2 + w_cd*Ts H(z)=------------------------------------- w_cd*Ts - 2 -1 1 + ------------- * z 2 + w_cd*Ts where w_cd is the cutoff frequency of the filter in the digital domain and Ts is the sampling period. However, mapping of the analog system into a digital domain using the bilinear transformation makes the relation between w_c and w_cd non-linear. This introduces a distortion in the frequency scale of the digital filter relative to that of the analog filter. This is known as warping effect. The warping effect can be eliminated by pre-warping the analog filter, and then transforming it into the digital domain, resulting in this transfer function: w_cd_p*Ts_p w_cd_p*Ts_p -1 ------------------ + ---------------- * z 2 + w_cd_p*Ts_p 2 + w_cd_p*Ts_p H(z)=------------------------------------- w_cd_p*Ts_p - 2 -1 1 + ----------------- * z 2 + w_cd_p*Ts_p where ωcd_p is the pre-warped cutoff frequency of the filter in the digital domain, and Ts_p is the pre-warped sampling period. The pre-warped cutoff frequency is calculated as follows: 2 w_cd*Ts w_cd_p = ------ * tan ( --------- ) Ts_p 2 and the pre-warped sampling period is: Ts_p = 0.5 Because the given filter equation is as described, the Butterworth low-pass filter coefficients are calculated as follows: w_cd_p*Ts_p a1 = a2 = ----------------- 2 + w_cd_p*Ts_p b1 = 1.0 w_cd_p*Ts_p - 2 b2 = ------------------ 2 + w_cd_p*Ts_p

public void ComputeButterworth(
   int order,
   float cutoffFrequency,
   float samplingPeriod
);

Parameters

order
Filter order
cutoffFrequency
Cuttof frequency in rad/s
samplingPeriod
Sampling period

See Also

IIRFilter Class | ORTS.Common Namespace