 function [signal]=ffiltr(x);
%load x;
x=x';
hdpcz(1,:)=x(1,:);
%load hdpcz;
outctv=hpf(hdpcz,1600);
rozctv=hdpcz-outctv;
furctv=(fft(rozctv));

osaf1=1:1:length(furctv)/2;       %vypocet frakci pi
osaf1=osaf1./length(osaf1);    %vypocet frakci pi
rpul = abs(furctv(1:length(furctv)/2));

% figure(1);plot(osaf1,rpul,'black');
% hold on
%    % line([2/32 2/6],[max(rpul) max(rpul)])
%     line([2/32 2/32],[0 max(rpul)])
%     line([2/6 2/6],[0 max(rpul)])
%     %pause
% %hold off
% figure(2);plot((ifft(furctv)));xlim([1, length(hdpcz)]);hold on

% 
% figure(1);plot(rozctv);xlim([1, length(hdpcz)]);grid on    %cyklicka slozka po filtraci HP
% figure(2);plot(osaf1,rpul);;grid on   %spektrum pofiltraci HP
% hold on
%    % line([2/32 2/6],[max(rpul) max(rpul)])
%     line([2/32 2/32],[0 max(rpul)])
%     line([2/6 2/6],[0 max(rpul)])
%     %pause
% hold off
%-----------------------------------------------------------------------
w=[0.23 0.54 0.23];

h=zeros(1,length(furctv)/2);
high = floor(2/6*length(h));        %vypocet hranic prenosu 1
low = ceil(2/32*length(h));

for i=low:high;         %vzorky s prenosem 1
    h(i)=1; 
end

hwc=conv(h,w);
hw=hwc(2:end-1);        %po konvoluci, delka poloviny vzorkovaciho kmitoctu

furctv=(fft(rozctv));
pul=furctv(1:length(furctv)/2);
filtr=pul.*hw;      %vyfiltrovane spektrum(polovina)

filtrc=conj(filtr);
filtr2=[filtr filtr];
for i=2:length(hw)
    filtr2(end+2-i)=filtrc(i);
end
filtr2;
signal=ifft(filtr2);
signal;%
% figure(1);plot(osaf1,abs(filtr),'r');
% hold on
%    % line([2/32 2/6],[max(rpul) max(rpul)])
%     line([2/32 2/32],[0 max(rpul)])
%     line([2/6 2/6],[0 max(rpul)])
%     %pause
% hold off
% 
% figure(2);plot((signal),'r');xlim([1, length(hdpcz)]);
% figure(5);plot(osaf1,hw,'r');
% hold on
%    % line([2/32 2/6],[max(rpul) max(rpul)])
%     line([2/32 2/32],[0 1])
%     line([2/6 2/6],[0 1])
%     %pause
% hold off
% cea12=signal;
% save cea12.mat
