compute symmetric window of various type
win_l=window('re',n)
win_l=window('tr',n)
win_l=window('hn',n)
win_l=window('hm',n)
win_l=window('kr',n,Beta)
[win_l,cwp]=window('ch',n,par)
:n window length : :par parameter 2-vector par=[dp,df]), where dp ( 0<dp<.5)
rules the main lobe width and df rules the side lobe height ( df>0). Only one of these two value should be specified the other one should set equal to a nonpositive value.
: :Beta Kaiser window parameter Beta >0). : :win window : :cwp unspecified Chebyshev window parameter :
function which calculates various symmetric window for Digital signal processing.
`clf`_()
N=24;
whm=window('hm',N);//Hamming window
wkr=window('kr',N,6);//Hamming Kaiser window
wch=window('ch',N,[0.005,-1]);//Chebychev window
//plot the window profile
`subplot`_(121);`plot`_(1:N,[whm;wkr;wch]')
`set`_(`gca`_(),'grid',[1 1]*`color`_('gray'))
`xlabel`_("n")
`ylabel`_("w_n")
`title`_(`gettext`_("Profile plot"))
//plot the magnitude of the frequency responses
n=256;
[Whm,fr]=`frmag`_(whm,n);
[Wkr,fr]=`frmag`_(wkr,n);
[Wch,fr]=`frmag`_(wch,n);
`subplot`_(122);`plot`_(fr,20*`log10`_([Whm;Wkr;Wch]'))
`set`_(`gca`_(),'grid',[1 1]*`color`_('gray'))
`xlabel`_(`gettext`_("Pulsation (rd/s)"))
`ylabel`_(`gettext`_("Magnitude (dB)"))
`legend`_(["Hamming N=24";"Kaiser N=24, Beta=6";"Chebychev N=24, dp=0.005"]);
`title`_(`gettext`_("Magnitude plot"))
`clf`_()
N=140;
w1=window('kr',N,1);
w2=window('kr',N,2);
w4=window('kr',N,4);
w8=window('kr',N,8);
w16=window('kr',N,16);
//plot the window profile
`plot`_(1:N,[w1;w2;w4;w8;w16]')
`set`_(`gca`_(),'grid',[1 1]*`color`_('gray'))
`legend`_("$\beta="+`string`_([1;2;4;8;16])+'$',[55,0.3])
`xlabel`_("n")
`ylabel`_("w_n")
`title`_(`gettext`_("Comparison of Kaiser window profiles"))
`clf`_()
N=140;
w1=window('ch',N,[0.001,-1]);
w2=window('ch',N,[0.05,-1]);
w3=window('ch',N,[-1,0.4]);
//plot the window profile
`subplot`_(121);`plot`_(1:N,[w1;w2;w3]')
`set`_(`gca`_(),'grid',[1 1]*`color`_('gray'))
//legend("$\beta="+string([1;2;4;8;16])+'$',[55,0.3])
`xlabel`_("n")
`ylabel`_("w_n")
`title`_(`gettext`_("Comparison of Chebychev window profiles"))
//plot the magnitude of the frequency responses
n=256;
[W1,fr]=`frmag`_(w1,n);
[W2,fr]=`frmag`_(w2,n);
[W3,fr]=`frmag`_(w3,n);
`subplot`_(122);`plot`_(fr,20*`log10`_([W1;W2;W3]'))
`set`_(`gca`_(),'grid',[1 1]*`color`_('gray'))
`xlabel`_(`gettext`_("Pulsation (rd/s)"))
`ylabel`_(`gettext`_("Magnitude (dB)"))
`legend`_(["Chebychef dp=0.001";"Chebychef dp=0.05";"Chebychef df=0.4"]);
`title`_(`gettext`_("Chebychev window Magnitude plot"))
IEEE. Programs for Digital Signal Processing. IEEE Press. New York: John Wiley and Sons, 1979. Program 5.2.