Transform lowpass analog filters to bandstop
Lowpass to Bandstop Transformation
Design a 10th-order lowpass Butterworth analog filter prototype.
n = 10; [z,p,k] = buttap(n);
Convert the prototype to transfer function form. Display its magnitude and frequency responses.
[b,a] = zp2tf(z,p,k); freqs(b,a)
Transform the prototype to a bandstop filter with a stopband from 20 Hz to 60 Hz. Specify the center frequency and bandwidth in rad/s.
fl = 20; fh = 60; Wo = 2*pi*sqrt(fl*fh); % center frequency Bw = 2*pi*(fh-fl); % bandwidth [bt,at] = lp2bs(b,a,Wo,Bw);
Display the magnitude and frequency responses of the transformed filter.
a — Prototype numerator and denominator coefficients
Prototype numerator and denominator coefficients, specified as row
a specify the
coefficients of the numerator and denominator of the prototype in descending
powers of s:
D — Prototype state-space representation
Prototype state-space representation, specified as matrices. The state-space matrices relate the state vector x, the input u, and the output y through
Wo — Center frequency
Center frequency, specified as a scalar. For a filter with lower band edge
w1 and upper band edge
Wo in units of rad/s.
Bw — Bandwidth
Bandwidth, specified as a scalar. For a filter with lower band edge
w1 and upper band edge
Bw in units of rad/s.
at — Transformed numerator and denominator coefficients
Transformed numerator and denominator coefficients, returned as row vectors.
Dt — Transformed state-space representation
Transformed state-space representation, returned as matrices.
lp2bs transforms analog lowpass filter prototypes with a cutoff
angular frequency of 1 rad/s into bandstop filters with the desired bandwidth and center
frequency. The transformation is one step in the digital filter design process for the
lp2bs is a highly accurate state-space formulation of the classic
analog filter frequency transformation. If a bandstop filter has center frequency
ω0 and bandwidth
Bw, the standard s-domain
where Q = ω0/Bw and p = s/ω0. The state-space version of this transformation is
lp2bs can perform the transformation on two different linear
system representations: transfer function form and state-space form. See
for a derivation of the bandpass version of this transformation.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
The input transfer function coefficients,
den, must be real.