

fs=44100;

np = 1;
    fp1=(F0*2^(np+(6/24)));     
    fp2=(F0*2^(np+(18/24)));
   
[b, a] = butter( 3, [fp1/(fs/2) fp2/(fs/2)], 'bandpass');
flag1 = isstable(b,a)
x_filt2 =filtfilt(b,a,x_filt1);





for np = 2:3
    fp1=(F0*2^(np+(6/24)));     % výpočet F0
    fp2=(F0*2^(np+(18/24)));

[b, a] = butter( 4, [fp1/(fs/2) fp2/(fs/2)], 'bandpass');
x_filt2=x_filt2+filtfilt(b,a,x_filt1);
flag23 = isstable(b,a)
end


np=4;                  % opakování v oktávách
    fp1=(F0*2^(np+(6/24)));     % výpočet F0
    fp2=(F0*2^(np+(18/24)));

[b, a] = butter( 5, [fp1/(fs/2) fp2/(fs/2)], 'bandpass');
x_filt2=x_filt2+filtfilt(b,a,x_filt1);
flag4 = isstable(b,a)



for np=5:6                 % opakování v oktávách
    fp1=(F0*2^(np+(6/24)));     % výpočet F0
    fp2=(F0*2^(np+(18/24)));
    
if fp2>fs/2
    break
end
[b, a] = butter( 6, [fp1/(fs/2) fp2/(fs/2)], 'bandpass');
x_filt2=x_filt2+filtfilt(b,a,x_filt1);
flag56 = isstable(b,a)
end
%{
if F0<99
np=7;                  % opakování v oktávách
    fp1=(F0*2^(np+(6/24)));     % výpočet F0
    fp2=(F0*2^(np+(18/24)));

[b, a] = butter( 8, [fp1/(fs/2) fp2/(fs/2)], 'bandpass');
x_filt2=x_filt2+filtfilt(b,a,x_filt1);
flag7 = isstable(b,a)
end
%}

y_out2(:,i)=x_filt2;
