Exact blackman window.
Applies exact Blackman window 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.
Example 1
Reduce spectral leakage of the FFT by first applying exact Blackman window to the the signal.
uses MtxExpr, Math387, MtxVec, SignalUtils, MtxVecTee;
procedure TForm1.Button1Click(Sender: TObject);
var h,h1,Response,Response1: Vector;
begin
h := Sin(Ramp(256,0,2*Pi*0.1));
h1.Copy(h);
BlackmanExact(H,wmSymmetric); //window the sine
Drawit(h);
h := h*2.344168; //scale the signal to compensate for energy loss
FrequencyResponse(h,nil,Response,8);
FrequencyResponse(h1,nil,Response1,8);
DrawIt([Response1,Response],['Rectangular window','Exact blackman']);
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,h1, Response,Response1, FreqFr;
h = Sin(Ramp(256,0,2*PI*0.1));
h1 = h;
BlackmanExact(h,wmSymmetric); //window the sine
DrawIt(h);
h = h*2.344168; //scale the signal to compensate for energy loss
FrequencyResponse(h,NULL,Response,8);
FrequencyResponse(h1,NULL,Response1,8);
DrawIt(OPENARRAY(TVec*, (Response,Response1)),OPENARRAY(AnsiString, ("Rectangular window","Exact blackman")));
}
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 = MtxExpr.Sin(MtxExpr.Ramp(256, 0, 2 * Math387.PI * 0.1));
Vector h1 = new Vector(0);
Vector Response = new Vector(0);
Vector Response1 = new Vector(0);
h1.Copy(h);
SignalUtils.BlackmanExact(h, TSignalWindowMode.wmSymmetric); //window the sinc impulse response
TeeChart.DrawIt(h,"",false);
h = h * 2.344168; //scale the signal to compensate for energy loss
SignalUtils.FrequencyResponse(h1,null, Response,8,false, TSignalWindowType.wtRectangular, 0);
SignalUtils.FrequencyResponse(h, null, Response1, 8, false, TSignalWindowType.wtRectangular, 0);
TeeChart.DrawIt(new TVec[2] { Response, Response1 }, new string[2] { "Rectangular window", "Exact blackman" }, "Frequency response", false);
}