Main Content

mkfilter

Generate Bessel, Butterworth, Chebyshev, or RC filter as an ss model

Description

fsys = mkfilter(fc,order,type) creates a single-input, single-output analog low-pass filter with cutoff frequency fc (in Hz) and filter order order. The type argument controls the filter type. The filter is returned as a state-space (ss) model object. The DC gain of the filter is 0 dB. You can use this syntax with any value of type except "cheby" or 'cheby'.

example

fsys = mkfilter(fc,order,type,psbndr) creates a Chebyshev filter with passband ripple psbndr when type is "cheby" or 'cheby'. At the cutoff frequency, the magnitude of the filter response is -psbndr dB. For even-order Chebyshev filters the DC gain is also -psbndr dB.

example

Examples

collapse all

Generate several different types of filters and compare their frequency responses.

butw = mkfilter(2,4,'butterw'); 
cheb = mkfilter(4,4,'cheby',0.5); 
rc = mkfilter(1,4,'rc'); 
bode(butw,'-',cheb,'--',rc,'-.')
legend('Butterworth','Chebyshev','RC filter')

MATLAB figure

Input Arguments

collapse all

Cutoff frequency of the low-pass filter in Hz, specified as a scalar.

Filter order, specified as a positive integer. Higher values result in sharper cutoff.

When type is "bessel" or 'bessel', filters are calculated using the recursive polynomial formula, which is poorly conditioned for order > 8).

Filter type, specified as one of the following strings or character vectors.

type value

Description

"butterw" or 'butterw'

Butterworth filter

"cheby" or 'cheby'

Chebyshev filter

"bessel" or 'bessel'

Bessel filter

"rc" or 'rc'

Series of resistor/capacitor filters

Chebyshev passband ripple in dB, specified as a scalar. For type= "cheby", use this argument to specify the passband ripple. At the cutoff frequency, the filter response magnitude is -psbndr dB. For even-order Chebyshev filters, the DC gain is also -psbndr dB.

Output Arguments

collapse all

Low-pass filter, returned as a state-space (ss) model object. For all types except even-order Chebyshev filters the DC gain is 0 dB. For even-order Chebyshev filters, the DC gain is -psbndr dB.

Version History

Introduced before R2006a

See Also

|