Blackman window.
Applies Blackman window with alfa parameter to Src. Window functions are applied to the signal prior to conversion to frequency domain with the FFT algorithm, to reduce the spectral leakage. Their side-effect is a lower frequency resolution. The window is defined as [1] p. 6-7:
Example 1
Compute the frequency response of a lowpass filter with a cutoff at 40 Hz, if the sampling frequency is 200Hz and the filter is designed with the blackman window.
uses MtxExpr, Math387, MtxVec, SignalUtils, MtxVecTee;
procedure TForm1.Button1Click(Sender: TObject);
var h,Response,FreqFr: Vector;
begin
h.Length := 100;
FirImpulse(h,[40],0,ftLowpass,wtRectangular,1,200);
Blackman(H,0.1,wmSymmetric);
FrequencyResponse(h,nil,Response,8);
FreqFr.Size(Response.Length);
FreqFr.Ramp(0,200*0.5/Response.Length);
DrawIt(FreqFr, Response);
end;
#include "MtxVecCPP.h" //MtxVecCPP.cpp must be included in the project
#include "MtxVecEdit.hpp"
#include "MtxVecTee.hpp"
#include "SignalUtils.hpp"
void __fastcall TForm41::BitBtn1Click(TObject *Sender)
{
Vector h,Response,FreqFr;
h->Length = 100;
FirImpulse(h,OPENARRAY(double,(40)),0,ftLowPass,wtRectangular,1,200);
Blackman(h,0.1,wmSymmetric); //window the sinc impulse response
FrequencyResponse(h,NULL,Response,8);
FreqFr = Ramp(Response->Length,0,200*0.5/Response->Length);
DrawIt(FreqFr, Response,"",false);
}
using Dew.Math;
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 h = new Vector(100);
Vector Response = new Vector(0);
Vector FreqFr = new Vector(0);
SignalUtils.FirImpulse(h, new double[1] {40},0, TFilterType.ftLowPass, TSignalWindowType.wtRectangular,1,200);
SignalUtils.Blackman(h,0.1,TSignalWindowMode.wmSymmetric); //window the sinc impulse response
SignalUtils.FrequencyResponse(h,null,Response,8,false,
TSignalWindowType.wtRectangular, 0);
FreqFr.Size(Response.Length);
FreqFr.Ramp(0,200*0.5/Response.Length);
TeeChart.DrawIt(FreqFr, Response,"Frequency response",false);
}
Declaration
Function Blackman(Src: TVec; alfa: TSample; WindowMode: TSignalWindowMode): TVec;