Overload List
| # | Signature | Description |
|---|---|---|
| 1 | void LowpassToBandpassZ(TVec *Num, TVec *Den, double Freq, double BW, double PrototypeFreq); | Apply frequency band transformation from lowpass to bandpass in the z-domain. |
| 2 | void LowpassToBandpassZ(TVec *z, TVec *p, double &k, double Freq, double BW, double PrototypeFreq); | The function returns modified z (zeros), p (poles) and k (gain). |
Overload 1: void LowpassToBandpassZ(TVec *Num, TVec *Den, double Freq, double BW, double PrototypeFreq);
Apply frequency band transformation from lowpass to bandpass in the z-domain.
Freq is the center frequency of the passband with width BW of the new filter. 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, BW 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) -> (-a2 + a1 z^(-1) - z^(-2))/(1 - a1 z^(-1) + a2 z^(-2)) beta = (cos((w2 + w1)/2))/(cos((w2 - w1)/2)) k1 = cot((w2 - w1)/2)tan(wc/2) a1 = (2 beta k1)/(k1 + 1), a2 = (k1 - 1)/(k1 + 1)
wc - old cutoff frequency w2 - desired upper cutoff frequency w1 - desired lower cutoff frequency
References:
[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
#include "MtxExpr.h"
#include "Units.Math387.h"
#include "Units.IIrFilters.h"
#include "Units.LinearSystems.h"
#include "Units.SignalUtils.h"
using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::Math387;
using namespace Dew::Signal;
using namespace Dew::Signal::Units::IIRFilters;
using namespace Dew::Signal::Units::LinearSystems;
using namespace Dew::Signal::Units::SignalUtils;
void Example()
{
Vector z, p, num, den, Response;
int Order;
double k, Wc, w1, w2, BW;
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.
w1 = 0.2; //start of the passband at 0.2Hz.
w2 = 0.5; //stop of the passband at 0.5Hz.
Wc = Sqrt(w1*w2); //center frequency of the passband
BW = w2-w1; //passband width
// LowpassToBandpassZ(z, p, k, Wc, BW, BilinearUnwarp(1));
// ZeroPoleToTransferFun(num, den, z, p, k);
//Alternative:
// ...
ZeroPoleToTransferFun(num, den, z, p, k);
LowpassToBandpassZ(num, den, Wc, BW, BilinearUnwarp(1));
FrequencyResponse(num, den, Response, 64);
}
Overload 2: void LowpassToBandpassZ(TVec *z, TVec *p, double &k, double Freq, double BW, double PrototypeFreq);
The function returns modified z (zeros), p (poles) and k (gain).
#include "MtxExpr.h"
#include "Units.Math387.h"
#include "Units.IIrFilters.h"
#include "Units.LinearSystems.h"
#include "Units.SignalUtils.h"
using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::Math387;
using namespace Dew::Signal;
using namespace Dew::Signal::Units::IIRFilters;
using namespace Dew::Signal::Units::LinearSystems;
using namespace Dew::Signal::Units::SignalUtils;
void Example()
{
Vector z(0);
Vector p(0);
Vector num(0);
Vector den(0);
Vector Response(0);
double k, Wc;
double FS = 2;
int Order = 4; //design a fourth order filter.
EllipticAnalog(Order, 0.1, 30, z, p, k); //design analog protype
Bilinear(z, p, k, FS, true);
double w1 = 0.2; //start of the passband at 0.2Hz.
double w2 = 0.5; //stop of the passband at 0.5Hz.
Wc = Sqrt(w1*w2); //center frequency of the passband
double BW = w2-w1; //passband width
LowpassToBandpassZ(z, p, k, Wc, BW, BilinearUnwarp(1, FS));
ZeroPoleToTransferFun(num, den, z, p, k);
FrequencyResponse(num, den, Response, 64, false, TSignalWindowType::wtRectangular, 0); //zero padding set to 64
//Alternative:
// ...
// ZeroPoleToTransferFun(num, den, z, p, k);
// LowpassToBandpassZ(num, den, Wc, BW, BilinearUnwarp(1, FS));
}