Overload List
| # | Signature | Description |
|---|---|---|
| 1 | procedure LowpassToBandstop(const a: TMtx; const b: TVec; const c: TVec; var D: Double; CenterFreq: Double; BW: Double); | Convert a lowpass filter prototype in state space form to a bandstop filter. |
| 2 | procedure LowpassToBandstop(const z: TVec; const p: TVec; var k: Double; CenterFreq: Double; BW: Double); | Frequency transformation from a lowpass to a bandstop filter in s-domain. |
Overload 1: procedure LowpassToBandstop(const a: TMtx; const b: TVec; const c: TVec; var D: Double; CenterFreq: Double; BW: Double);
Convert a lowpass filter prototype in state space form to a bandstop filter.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | a | TMtx | |
| 2 | b | TVec | |
| 3 | c | TVec | |
| 4 | D | Double | |
| 5 | CenterFreq | Double | scalar |
| 6 | BW | Double | scalar |
Result: stored in self (calling object)
Overload 2: procedure LowpassToBandstop(const z: TVec; const p: TVec; var k: Double; CenterFreq: Double; BW: Double);
Frequency transformation from a lowpass to a bandstop filter in s-domain.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | z | TVec | |
| 2 | p | TVec | |
| 3 | k | Double | |
| 4 | CenterFreq | Double | scalar |
| 5 | BW | Double | scalar |
Result: stored in self (calling object)
Transform a lowpass filter prototype in zero-pole form to a bandstop filter, where the stopband has width BW centered around the frequency CenterFreq. Assumed sampling frequency is 2. The transformation is defined as ([1], p. 258): s -> (s (W_u - W_l))/(s^2 + W_u W_l)
Wl - lower cutoff frequency Wu - upper cutoff frequency
The routine also adds pairs of zeros at +/-j*CenterFreq, if the number of zeros is less then number of poles, to match the number of poles.
References:
[1] Theory and application of digital signal processing, Lawrence R. Rabiner and Bernard Gold. Prentice-Hall, 1975
uses MtxExpr, Math387, MtxVec, MtxVecTee, MtxVecEdit,
LinearSystems, IirFilters, SignalUtils;
procedure TForm1.Button1Click(Sender: TObject);
var z,p, num,den, FreqFr,Response: Vector;
Order: integer;
k,Wc,BW: Double;
begin
Order := 5; //design a fifth order filter.
EllipticAnalog(Order,0.2,40,z,p,k); //design analog protype
Wc := Sqrt(0.2*0.6);
BW := 0.6-0.2;
LowpassToBandstop(z,p,k,WC,BW); //frequency transformation in s-domain
ZeroPoleToTransferFun(num,den,z,p,k);
//Define the frequency grid (logarithmic)
FreqFr.Length := 1000;
LogRamp(FreqFr,-1,1); //between 0.1 (=10^(-1)) and 10 (=10^1) rad/sec
FrequencyResponseS(num,den,FreqFr,Response); //Laplace
DrawIt(Response); //Y axis linear, X axis logarithmic
end;