Design Bessel IIR filter.
The resulting transfer function is returned in the numerator/denumerator form with num and den.
Design Bessel filter of Order with CutoffFreq frequencies and of FilterType type. Set Analog to True, to request an analog filter design in s-plane or set it to false to obtain a digital filter design in z-plane. CutoffFreq must be in range between 0 and 1 (Sampling frequency = 2). IIrFrequencyTransform specifies when and how will the frequency band transformation be applied. Bessel filters typically do not preserve a flat group delay once transformed to z-domain. The routine uses bilinear transformation to map from s to z-domain. Use matched-Z transform to preserve more phase properties of the Bessel filters in the z-domain. The resulting transfer function is returned in the zero-pole form, with z,p,k variables.
The resulting transfer function is returned in the state-space form with A,B,C,D variables.
Example 1
Design a fifth order analog lowpass filter with the cutoff frequency at 3 rad/sec.
uses MtxExpr, Math387, MtxVec, SignalUtils, MtxVecTee, MtxVecEdit, IirFilters,
LinearSystems;
procedure TForm1.Button1Click(Sender: TObject);
var z,p, num,den, FreqFr,Response: Vector;
Order: integer;
k,Bw,Wc: TSample;
WcArray: TSampleArray; //modified 3dB frequency
begin
BesselFilter(5,[3],ftLowpass,True,num,den);
FreqFr.Length := 1000; //Define the frequency grid (logarithmic)
LogRamp(FreqFr,-1,1); //between 0.1 (=10^(-1)) and 10 (=10^1) rad/sec
FrequencyResponseS(num,den,FreqFr,Response); //Laplace
DrawIt(FreqFr,20*Log10(Abs(Response))); //logarithmic frequency and amplitude
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 num, den, FreqFr, Response;
BesselFilter(5,OPENARRAY(double,(3)),ftLowPass,true,num,den);
FreqFr->Length = 1000; //Define the frequency grid (logarithmic)
LogRamp(FreqFr,-1,1); //between 0.1 (=10^(-1)) and 10 (=10^1) rad/sec
FrequencyResponseS(num,den,FreqFr,Response); //Laplace
DrawIt(FreqFr,20*Log10(Abs(Response)),"Frequency response",false); //logarithmic frequency and amplitude
}
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 num = new Vector(0);
Vector den = new Vector(0);
Vector Response = new Vector(0);
Vector FreqFr = new Vector(0);
IIRFilters.BesselFilter(5, new double[1] {3}, TFilterType.ftLowPass, true, num,den,TIirFrequencyTransform.ftStateSpaceAnalog); //design analog protype
FreqFr.Length = 1000;
SignalUtils.LogRamp(FreqFr, -1, 1);
SignalUtils.FrequencyResponseS(num, den, FreqFr, Response, 0);
TeeChart.DrawIt(Response, "Frequency response", false);
}