Transform lowpass analog filters to highpass
Lowpass to Highpass Transformation
Design a 5th-order highpass elliptic filter with a cutoff frequency of 100 Hz, 3 dB of passband ripple, and 30 dB of stopband attenuation
Design the prototype. Convert the zero-pole-gain output to a transfer function.
f = 100; [ze,pe,ke] = ellipap(5,3,30); [be,ae] = zp2tf(ze,pe,ke);
Transform the prototype to a highpass filter. Specify the cutoff frequency in rad/s.
[bh,ah] = lp2hp(be,ae,2*pi*f);
Compute and plot the frequency response of the filter. Divide the normalized frequency by so the x-axis of the plot is in Hz.
[hh,wh] = freqs(bh,ah,4096); semilogx(wh/2/pi,mag2db(abs(hh))) axis([10 400 -40 5]) grid
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 — Cutoff angular frequency
Cutoff angular frequency, specified as a scalar. Express the cutoff angular frequency in 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.
lp2hp transforms analog lowpass filter prototypes with a cutoff
angular frequency of 1 rad/s into highpass filters with a desired cutoff angular
frequency. The transformation is one step in the digital filter design process for the
lp2hp is a highly accurate state-space formulation of the classic
analog filter frequency transformation. If a highpass filter is to have a cutoff angular
frequency ω0, the standard
s-domain transformation is
The state-space version of this transformation is:
At = Wo*inv(A); Bt = -Wo*(A\B); Ct = C/A; Dt = D - C/A*B;
lp2bp for a derivation of the bandpass version of this
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.