Код:
Fs := ReadInteger(_Data,Freq,_prop_Freq);//дескритизация
nn := ReadInteger(_Data,Leng,_prop_Leng);//длина блока данных
sh90 := ReadInteger(_Data,Sh90dgr,_prop_Sh90dgr);//наличие сдвига
M := ReadInteger(_Data,Order,_prop_Order); //кол-во точек фильтра
flf := ReadInteger(_Data,FLFreq,_prop_FLFreq);//ВЕРХНЯЯ частота
fhf := ReadInteger(_Data,FHFreq,_prop_FHFreq);//нижняя частота
for i := -200 to 200 do xi[i] := 0; //обнуляем регистр
wh := 2*pi*(fhf/Fs); wl := 2*pi*(flf/Fs);
qh := wh/pi; ql := wl/pi;
N := M div 2;
if sh90>0 then//если включен режим фазового сдвига
begin
for i := 0 to N do
begin
if i = 0 then h[i] := qh - ql
else
begin
h[i] := qh*(cos(i*wh)/(i*wh)) - ql*(cos(i*wl)/(i*wl));
h[-i] := qh*(cos(i*wh)/(i*wh)) - ql*(cos(i*wl)/(i*wl));
end;
//_hi_OnEvent(onSet,h[i]);
end;
end
else //иначе
begin
for i := 0 to N do
begin
if i = 0 then h[i] := qh - ql
else
begin
h[i] := qh*(sin(i*wh)/(i*wh)) - ql*(sin(i*wl)/(i*wl));
h[-i] := qh*(sin(i*wh)/(i*wh)) - ql*(sin(i*wl)/(i*wl));
end;
//_hi_OnEvent(onSet,h[i]);
end;
end;
//Оконная функция
for i := 0 to M-1 do
begin
win[i - M div 2] := 0.54 - 0.46*cos(2*pi*i/M); //Хемминга
//win[i - M div 2] := 0.42 - 0.5*cos(2*pi*i/M) + 0.08*cos(4*pi*i/M); //Блэкмана
h[i - M div 2] := win[i - M div 2]*h[i - M div 2]
end;