You are here: Symbol Reference > SignalUtils Namespace > Functions > SignalUtils.Bartlett Function
DSP Master VCL
ContentsIndex
PreviousUpNext
SignalUtils.Bartlett Function

Bartlett window.

Pascal
function Bartlett(const Src: TVec): TVec; overload;

Applies Bartlett window to Src vector. 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. Bartlett window is a "triangular" window defined as [1] p. 248:

           2*n              M - 1
w[n] =  -------, 0 <= n <= ------
         M - 1               2

             2*n     M - 1
w[n] = 2 - -------, ------ <= n <=  M - 1
            M - 1      2

w[n] = 0, for other n's

References:  

[1] Digital signal processing, Vinay K. Ingle and John G. Proakis, Brooks-Cole, 2000.

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 bartlett window.

uses MtxExpr, Math387, MtxVec, SignalUtils, MtxVecTee;

procedure TForm1.Button1Click(Sender: TObject);
var h,Response,FreqFr: Vector;
begin
    h.Size(100);
    FirImpulse(h,[40],0,ftLowpass,wtRectangular,1,200);
    Bartlett(H);  //window the sinc impulse response
    FrequencyResponse(h,nil,Response,8);
    FreqFr.Size(Response.Length);
    FreqFr.Ramp(0,200*0.5/Response.Length);
    DrawIt(FreqFr, Response);
end;

 

#include "MtxExpr.hpp"
#include "MtxVecEdit.hpp"
#include "MtxVecTee.hpp"
#include "SignalUtils.hpp"

void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
    sVector h,Response,FreqFr;

    h.Length = 100;
    FirImpulse(h,OPENARRAY(double,(40)),0,ftLowpass,wtRectangular,1,200);
    Bartlett(h);  //window the sinc impulse response
    FrequencyResponse(h,NULL,Response,8);

    FreqFr = Ramp(Response.Length, mvDouble, 0,200*0.5/Response.Length);
    DrawIt(FreqFr, Response,"",false);
}
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!