DewDSPMasterNET
LowpassToHighPassZ Routines
Summary
Apply frequency band transformation from lowpass to highpass in the z-domain Freq is the cutoff frequency of the new filter.

Unit
LinearSystems

Declaration
Procedure LowpassToHighPassZ(z, p: TVec; var k: TSample; Freq: TSample; PrototypeFreq: TSample);

Description
The function returns modified z (zeros), p (poles) and k (gain).
Categories
IIR filter design routines
 See Also 
[1] "Theory and application of digital signal processing, Lawrence R. Rabiner and Bernard Gold. Prentice-Hall, 1975". 
[2] "Discrete-time signal processing, Oppenheim and Schafer, Prentice-Hall, 1989". 
[3] "Digital signal processing, Vinay K. Ingle and John G. Proakis, Brooks-Cole, 2000". 
Bilinear 
RationalSubstitution 
LowpassToHighpass 
LowpassToLowpassZ 
LowpassToBandpassZ 
LowpassToBandstopZ 

Example 1

Elliptic highpass filter design. The cutoff frequency of a lowpass analog filter prototype transformed in to z domain is obtained with BilinearUnwarp method. The analog prototype filter has a normalized cutoff frequency at 1 rad/sec.
uses MtxExpr, Math387, MtxVec, MtxVecTee, MtxVecEdit, LinearSystems, IirFilters, SignalUtils; procedure TForm1.Button1Click(Sender: TObject); var z,p,num,den,Response: Vector; Order: integer; k,Wc: TSample; begin Order := 4;//design a fourth order filter. EllipticAnalog(Order,0.1,30,z,p,k); //design analog protype Bilinear(z,p,k,2); //bilinear with sampling frequency 2Hz. Wc := 0.5; //desired cutoff at 0.5 Hz. LowpassToHighpassZ(z,p,k,Wc,BilinearUnwarp(1)); //move cutoff to 0.5 Hz. ZeroPoleToTransferFun(num,den,z,p,k); //Alternative: // ... // ZeroPoleToTransferFun(num,den,z,p,k); // LowpassToHighpassZ(num,den,Wc,BW,BilinearUnwarp(1)); //move cutoff to 0.5 Hz. FrequencyResponse(num,den,Response,64); DrawIt(Response); end;
#include "MtxVecCPP.h" //MtxVecCPP.cpp must be included in the project #include "MtxVecEdit.hpp" #include "MtxVecTee.hpp" #include "SignalUtils.hpp" #include "IirFilters.hpp" #include "LinearSystems.hpp" void __fastcall TForm1::BitBtn1Click(TObject *Sender) { Vector z,p,num,den,Response; int Order; double k,Wc; Order = 4;//design a fourth order filter. EllipticAnalog(Order,0.1,30,z,p,k); //design analog protype Bilinear(z,p,k,2); //bilinear with sampling frequency 2Hz. Wc = 0.5; //desired cutoff at 0.5 Hz. LowpassToHighPassZ(z,p,k,Wc,BilinearUnwarp(1)); //move cutoff to 0.5 Hz. ZeroPoleToTransferFun(num,den,z,p,k); //Alternative: // ... // ZeroPoleToTransferFun(num,den,z,p,k); // LowpassToHighpassZ(num,den,Wc,BW,BilinearUnwarp(1)); //move cutoff to 0.5 Hz. FrequencyResponse(num,den,Response,64); DrawIt(Response); }
using Dew.Math; using Dew.Math.Editors; using Dew.Math.Units; using Dew.Signal; using Dew.Signal.Units; using Dew.Math.Tee; using Dew.Signal.Tee; private void button1_Click(object sender, EventArgs e) { Vector z = new Vector(0); Vector p = new Vector(0); Vector num = new Vector(0); Vector den = new Vector(0); Vector Response = new Vector(0); double k, Wc; double FS = 2; int Order = 4; //design a fifth order filter. IIRFilters.EllipticAnalog(Order,0.1,30, z, p, out k); //design analog protype LinearSystems.Bilinear(z, p, ref k, FS,true); Wc = 0.5; LinearSystems.LowpassToHighPassZ(z, p, ref k, Wc, LinearSystems.BilinearUnwarp(1,FS)); LinearSystems.ZeroPoleToTransferFun(num,den, z, p, k); SignalUtils.FrequencyResponse(num, den, Response, 64, false, TSignalWindowType.wtRectangular, 0); //zero padding set to 64 //Alternative: // ... // LinearSystems.ZeroPoleToTransferFun(num,den, z, p, k); // LinearSystems.LowpassToHighPassZ(num,den, Wc, LinearSystems.BilinearUnwarp(1,FS)); TeeChart.DrawIt(Response, "Frequency response", false); //TeeChart.DrawIt(20 * MtxExpr.Log10(MtxExpr.Abs(Response)), "Magnitude", false); //TeeChart.DrawIt(MtxExpr.PhaseSpectrum(Response) * (180 / Math.PI), "Phase", false); }


Declaration
Procedure LowpassToHighPassZ(num, den: TVec; Freq: TSample; PrototypeFreq: TSample);

Description
The function returns modified num and den. PrototypeFreq is the cutoff frequency of the prototype lowpass filter after it has been mapped to z-domain. Freq and PrototypeFreq must be between 0 and 1 (Sampling frequency = 2). The transformation is defined with the following mapping ([1] p. 260 and [2] p. 434, [3] p. 352):
z^(-1) + a z^(-1) ---> - ------------- 1 + a*z^(-1) cos((wc - wn)/2) a = ------------------- cos((wc + wn)/2) wc - old cutoff frequency wn - new (desired) cutoff frequency

Copyright 2008 Dew Research
http://www.dewresearch.com