function [H,p]=pravd_prekroceni_rog_dor_nove(mezeC1A,mezeC2A,mezeC3A,mezeC4A,mezeC1B,mezeC2B,mezeC3B,mezeC4B,t_CH4,t_C2H2,t_C2H4,t_H2,t_C2H6,t_CO,t_soucet,CH4,C2H2,C2H4,H2,C2H6,CO,soucet,tau,out,k)

% meze ...postupne CH4, C2H2, C2H4, H2, C2H6, CO
%         vstupem casove rady a jim prislusne casy
% tau  ...cas, kdy urcujeme pravdepodobnost prekroceni mezi
% out  ...vyradit/nevyradit odlehle hodnoty, out=1 - vyradit
% k    ...volime metodu pro odhad trendu
% H    ...vysledky testu dobre shody (analyza chyby), 1-normalni rozdeleni
%         nezamitnuto, celkem 6 hodnot, predikuje se 6 ruznych rad
% p    ...pravdepodobnost, splneni predpokladu 1a, 1b v case tau

C1m1d=0;C1m1h=inf;C1m2d=0;C1m2h=inf;C1m3d=0;C1m3h=inf;C1m4d=0;C1m4h=inf;C1m5d=0;C1m5h=inf;
C1m6d=0;C1m6h=inf;C1m7d=0;C1m7h=inf;C1m8d=0;C1m8h=inf;

C2m1d=121;C2m1h=inf;C2m2d=36;C2m2h=inf;C2m3d=51;C2m3h=inf;C2m4d=101;C2m4h= inf;C2m5d=66;C2m5h= inf;
C2m6d=351;C2m6h=inf;C2m7d=2500;C2m7h=inf;C2m8d=721;C2m8h=inf;

C3m1d=401;C3m1h=inf;C3m2d=51;C3m2h=inf;C3m3d=101;C3m3h=inf;C3m4d=701;C3m4h= inf;C3m5d=101;C3m5h=inf;
C3m6d=571;C3m6h=inf;C3m7d=4001;C3m7h=inf;C3m8d=1921;C3m8h=inf;

C4m1d=1000;C4m1h=inf;C4m2d=80;C4m2h=inf;C4m3d=200;C4m3h=inf;C4m4d=1800;C4m4h= inf;
C4m5d=150;C4m5h=inf;C4m6d=1400;C4m6h=inf;C4m7d=10000;C4m7h=inf;C4m8d=4630;C4m8h=inf;

mezeC1=[C1m1d,C1m2d,C1m3d,C1m4d,C1m5d,C1m6d,C1m7d,C1m8d,C1m1h,C1m2h,C1m3h,C1m4h,C1m5h,C1m6h,C1m7h,C1m8h];
mezeC2=[C2m1d,C2m2d,C2m3d,C2m4d,C2m5d,C2m6d,C2m7d,C2m8d,C2m1h,C2m2h,C2m3h,C2m4h,C2m5h,C2m6h,C2m7h,C2m8h];
mezeC3=[C3m1d,C3m2d,C3m3d,C3m4d,C3m5d,C3m6d,C3m7d,C3m8d,C3m1h,C3m2h,C3m3h,C3m4h,C3m5h,C3m6h,C3m7h,C3m8h];
mezeC4=[C4m1d,C4m2d,C4m3d,C4m4d,C4m5d,C4m6d,C4m7d,C4m8d,C4m1h,C4m2h,C4m3h,C4m4h,C4m5h,C4m6h,C4m7h,C4m8h];

mezeC1A=[2*C1m1d,2*C1m2d,2*C1m3d,2*C1m4d,inf,inf,inf,inf,inf,inf,inf,inf,inf,inf,inf,inf];
mezeC2A=[2*C2m1d,2*C2m2d,2*C2m3d,2*C2m4d,inf,inf,inf,inf,inf,inf,inf,inf,inf,inf,inf,inf];
mezeC3A=[2*C3m1d,2*C3m2d,2*C3m3d,2*C3m4d,inf,inf,inf,inf,inf,inf,inf,inf,inf,inf,inf,inf];
mezeC4A=[2*C4m1d,2*C4m2d,2*C4m3d,2*C4m4d,inf,inf,inf,inf,inf,inf,inf,inf,inf,inf,inf,inf];

%násobení 2 a ty inf nastavit nahoře, tady mu chybí 8 dalších mezí...viz
%pravd_prekroceni_nove
[H_aC1,p_aC1]=pravd_prekroceni(mezeC1A,t_CH4,t_C2H2,t_C2H4,t_H2,t_C2H6,t_CO,t_CO,t_soucet,CH4,C2H2,C2H4,H2,C2H6,CO,CO,soucet,tau,out,k);
[H_aC2,p_aC2]=pravd_prekroceni(mezeC2A,t_CH4,t_C2H2,t_C2H4,t_H2,t_C2H6,t_CO,t_CO,t_soucet,CH4,C2H2,C2H4,H2,C2H6,CO,CO,soucet,tau,out,k);
[H_aC3,p_aC3]=pravd_prekroceni(mezeC3A,t_CH4,t_C2H2,t_C2H4,t_H2,t_C2H6,t_CO,t_CO,t_soucet,CH4,C2H2,C2H4,H2,C2H6,CO,CO,soucet,tau,out,k);
[H_aC4,p_aC4]=pravd_prekroceni(mezeC4A,t_CH4,t_C2H2,t_C2H4,t_H2,t_C2H6,t_CO,t_CO,t_soucet,CH4,C2H2,C2H4,H2,C2H6,CO,CO,soucet,tau,out,k);

mezeC1B=[inf,inf,inf,inf,C1m5d,C1m6d,inf,inf,inf,inf,inf,inf,inf,inf,inf,inf];
mezeC2B=[inf,inf,inf,inf,C2m5d,C2m6d,inf,inf,inf,inf,inf,inf,inf,inf,inf,inf];
mezeC3B=[inf,inf,inf,inf,C3m5d,C3m6d,inf,inf,inf,inf,inf,inf,inf,inf,inf,inf];
mezeC4B=[inf,inf,inf,inf,C4m5d,C4m6d,inf,inf,inf,inf,inf,inf,inf,inf,inf,inf];

[H_bC1,p_bC1]=pravd_prekroceni(mezeC1B,t_CH4,t_C2H2,t_C2H4,t_H2,t_C2H6,t_CO,t_CO,t_soucet,CH4,C2H2,C2H4,H2,C2H6,CO,CO,soucet,tau,out,k);
[H_bC2,p_bC2]=pravd_prekroceni(mezeC2B,t_CH4,t_C2H2,t_C2H4,t_H2,t_C2H6,t_CO,t_CO,t_soucet,CH4,C2H2,C2H4,H2,C2H6,CO,CO,soucet,tau,out,k);
[H_bC3,p_bC3]=pravd_prekroceni(mezeC3B,t_CH4,t_C2H2,t_C2H4,t_H2,t_C2H6,t_CO,t_CO,t_soucet,CH4,C2H2,C2H4,H2,C2H6,CO,CO,soucet,tau,out,k);
[H_bC4,p_bC4]=pravd_prekroceni(mezeC4B,t_CH4,t_C2H2,t_C2H4,t_H2,t_C2H6,t_CO,t_CO,t_soucet,CH4,C2H2,C2H4,H2,C2H6,CO,CO,soucet,tau,out,k);

pC1=p_aC1*p_bC1;
pC2=p_aC2*p_bC2;
pC3=p_aC3*p_bC3;
pC4=p_aC4*p_bC4;
p=[pC1,pC2,pC3,pC4];

HC1=[H_aC1(1:4) H_bC1(5) H_bC1(6)]';
HC2=[H_aC2(1:4) H_bC2(5) H_bC2(6)]';
HC3=[H_aC3(1:4) H_bC3(5) H_bC3(6)]';
HC4=[H_aC4(1:4) H_bC4(5) H_bC4(6)]';
H=[HC1 HC2 HC3 HC4]';


