% Analyza rozdilu mezi detekcemi hranice ryhy ve dvou polich
% Doporucuje se spoustet skript po castech
% Nazev testovane skupiny je napsan na zacatku kazde casti
% Verze MATLAB - R2015b
% Autor - Zumberg Inna (ID 185961)

%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Tri serii, CMFDA

%% porovnani hned po vytvoreni ryhy 

clear;clc
svetlo=[591.9328 590.1782 621.1976 579.7123 513.5433 546.0411 595.6667 516.98 531.4526 537.5579];
fluo=[595.0622 605.7764 580.7432 583.6421 505.4609 513.6312 541.0747 451.8007 495.1096 447.2307];

[Hs,Ps]=lillietest(svetlo,'Alpha',0.05);
[Hf,Pf]=lillietest(fluo,'Alpha',0.05);

   if Hs==1 | Hf==1;
   [p,h]=signrank(svetlo,fluo,'Alpha',0.05);
   else
   [h,p]=ttest(svetlo,fluo,'Alpha',0.05);
   end

data=zeros(10,2);
data(:,1)=svetlo;
data(:,2)=fluo;
fig1=figure; set(fig1,'Color','w');
boxplot(data,'Labels',{'Bez barviva','CMFDA'});
ylabel('Sirka ryhy [µm]')

nazev=['p-hodnota = ',num2str(p)];
disp(nazev)
if p<0.05
    disp('Zamitame nulovou hypotezu. Kvalita detekce se lisi')
else
    disp('Nezamitame nulovou hypotezu. Kvalita detekce se nelisi')
end

%% po 17 hodinach 

clear;clc
svetlo=[424.1846 478.9458 361.97 402.2886 261.2815 350.5734 349.8965 263.2899 198.8098 270.7545];
fluo=[427.5178 473.8036 386.2062 421.9904 235.3165 354.4777 389.6418 279.8544 145.1196 281.4876];

[Hs,Ps]=lillietest(svetlo,'Alpha',0.05);
[Hf,Pf]=lillietest(fluo,'Alpha',0.05);

   if Hs==1 | Hf==1;
   [p,h]=signrank(svetlo,fluo,'Alpha',0.05);
   else
   [h,p]=ttest(svetlo,fluo,'Alpha',0.05);
   end

data=zeros(10,2);
data(:,1)=svetlo;
data(:,2)=fluo;

fig1=figure; set(fig1,'Color','w');
boxplot(data,'Labels',{'Bez barviva','CMFDA'});
ylabel('Sirka ryhy [µm]')

nazev=['p-hodnota = ',num2str(p)];
disp(nazev)
if p<0.05
    disp('Zamitame nulovou hypotezu. Kvalita detekce se lisi')
else
    disp('Nezamitame nulovou hypotezu. Kvalita detekce se nelisi')
end

%% po 40 hodinach 

clear;clc
svetlo=[56.3053 24.0725 0 1.5486 0 8.7448 4.5734 0 0 11.341];
fluo=[29.8782 64.302 1.2647 4.0746 0 9.8681 7.8208 0 0 15.4301];

[Hs,Ps]=lillietest(svetlo,'Alpha',0.05);
[Hf,Pf]=lillietest(fluo,'Alpha',0.05);

   if Hs==1 | Hf==1;
   [p,h]=signrank(svetlo,fluo,'Alpha',0.05);
   else
   [h,p]=ttest(svetlo,fluo,'Alpha',0.05);
   end
   
data=zeros(10,2);
data(:,1)=svetlo;
data(:,2)=fluo;
boxplot(data,'Labels',{'Bez barviva','CMFDA'});
ylabel('Sirka ryhy [µm]')

nazev=['p-hodnota = ',num2str(p)];
disp(nazev)
if p<0.05
    disp('Zamitame nulovou hypotezu. Kvalita detekce se lisi')
else
    disp('Nezamitame nulovou hypotezu. Kvalita detekce se nelisi')
end

%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Dve serii, CMFDA

%% porovnani hned po vytvoreni ryhy 

clear;clc
svetlo=[420.9817 337.6237 412.8147 395.7826 371.0477 398.5291 425.3903 350.6379 383.4052 384.7322];
fluo=[412.2046 329.509 403.6546 401.0573 362.363 371.7313 429.348 358.4899 381.1775 372.269];

[Hs,Ps]=lillietest(svetlo,'Alpha',0.05);
[Hf,Pf]=lillietest(fluo,'Alpha',0.05);

   if Hs==1 | Hf==1;
   [p,h]=signrank(svetlo,fluo,'Alpha',0.05);
   else
   [h,p]=ttest(svetlo,fluo,'Alpha',0.05);
   end

data=zeros(10,2);
data(:,1)=svetlo;
data(:,2)=fluo;
boxplot(data,'Labels',{'Bez barviva','CMFDA'});
ylabel('Sirka ryhy [µm]')

nazev=['p-hodnota = ',num2str(p)];
disp(nazev)
if p<0.05
    disp('Zamitame nulovou hypotezu. Kvalita detekce se lisi')
else
    disp('Nezamitame nulovou hypotezu. Kvalita detekce se nelisi')
end

%% po 24 hodinach  

clear;clc
svetlo=[0 0 1.4361 3.0649 0 2.093 8.9063 0 10.2934 9.8637];
fluo=[10.9246 0 0 5.2001 0 0 14.5216 0 21.1457 4.0746];

[Hs,Ps]=lillietest(svetlo,'Alpha',0.05);
[Hf,Pf]=lillietest(fluo,'Alpha',0.05);

   if Hs==1 | Hf==1;
   [p,h]=signrank(svetlo,fluo,'Alpha',0.05);
   else
   [h,p]=ttest(svetlo,fluo,'Alpha',0.05);
   end

data=zeros(10,2);
data(:,1)=svetlo;
data(:,2)=fluo;
boxplot(data,'Labels',{'Bez barviva','CMFDA'});
ylabel('Sirka ryhy [µm]')

nazev=['p-hodnota = ',num2str(p)];
disp(nazev)
if p<0.05
    disp('Zamitame nulovou hypotezu. Kvalita detekce se lisi')
else
    disp('Nezamitame nulovou hypotezu. Kvalita detekce se nelisi')
end



%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Tri serii, Nanocastice

%% porovnani hned po vytvoreni ryhy
clear;clc
svetlo=[492.0291 535.2378 571.1456 554.5888 512.4946 593.5537 711.1474 481.7558 535.1287 611.6512];
fluo=[512.4066 536.5136 578.4342 560.5071 547.2969 573.7017 698.0218 513.8505 548.9011 604.6397];

[Hs,Ps]=lillietest(svetlo,'Alpha',0.05);
[Hf,Pf]=lillietest(fluo,'Alpha',0.05);

   if Hs==1 | Hf==1;
   [p,h]=signrank(svetlo,fluo,'Alpha',0.05);
   else
   [h,p]=ttest(svetlo,fluo,'Alpha',0.05);
   end

data=zeros(10,2);
data(:,1)=svetlo;
data(:,2)=fluo;
boxplot(data,'Labels',{'Bez barviva','Nanocastice'});
ylabel('Sirka ryhy [µm]')

nazev=['p-hodnota = ',num2str(p)];
disp(nazev)
if p<0.05
    disp('Zamitame nulovou hypotezu. Kvalita detekce se lisi')
else
    disp('Nezamitame nulovou hypotezu. Kvalita detekce se nelisi')
end

%% po 17 hodinach 

clear;clc
svetlo=[271.5504 259.4413 363.6121 275.025 185.2956 342.8483 465.395 194.763 284.3153 295.9914];
fluo=[212.8249 283.6941 391.5477 263.3734 191.7037 380.3258 487.1374 201.8913 300.4779 330.5744];

[Hs,Ps]=lillietest(svetlo,'Alpha',0.05);
[Hf,Pf]=lillietest(fluo,'Alpha',0.05);

   if Hs==1 | Hf==1;
   [p,h]=signrank(svetlo,fluo,'Alpha',0.05);
   else
   [h,p]=ttest(svetlo,fluo,'Alpha',0.05);
   end

data=zeros(10,2);
data(:,1)=svetlo;
data(:,2)=fluo;

boxplot(data,'Labels',{'Bez barviva','Nanocastice'});
ylabel('Sirka ryhy [µm]')

nazev=['p-hodnota = ',num2str(p)];
disp(nazev)
if p<0.05
    disp('Zamitame nulovou hypotezu. Kvalita detekce se lisi')
else
    disp('Nezamitame nulovou hypotezu. Kvalita detekce se nelisi')
end

%% po 40 hodinach 

clear;clc
svetlo=[5.5508 3.0359 62.4907 0 6.5628 0 14.5528 0 0 0];
fluo=[0 0 31.733 0 0 1.8213 25.2425 0 0 0];

[Hs,Ps]=lillietest(svetlo,'Alpha',0.05);
[Hf,Pf]=lillietest(fluo,'Alpha',0.05);

   if Hs==1 | Hf==1;
   [p,h]=signrank(svetlo,fluo,'Alpha',0.05);
   else
   [h,p]=ttest(svetlo,fluo,'Alpha',0.05);
   end
   
data=zeros(10,2);
data(:,1)=svetlo;
data(:,2)=fluo;
boxplot(data,'Labels',{'Bez barviva','Nanocastice'});
ylabel('Sirka ryhy [µm]')

nazev=['p-hodnota = ',num2str(p)];
disp(nazev)
if p<0.05
    disp('Zamitame nulovou hypotezu. Kvalita detekce se lisi')
else
    disp('Nezamitame nulovou hypotezu. Kvalita detekce se nelisi')
end

%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Dve serii, Nanocastice

%% porovnani hned po vytvoreni ryhy 

clear;clc
svetlo=[379.414 425.5351 445.2735 463.5202 480.1883 395.0033 460.7804 373.7129 503.2054 355.5308];
fluo=[358.245 440.0411 425.898 440.8126 447.2218 401.7843 404.572 343.0565 468.3752 393.8288];

[Hs,Ps]=lillietest(svetlo,'Alpha',0.05);
[Hf,Pf]=lillietest(fluo,'Alpha',0.05);

   if Hs==1 | Hf==1;
   [p,h]=signrank(svetlo,fluo,'Alpha',0.05);
   else
   [h,p]=ttest(svetlo,fluo,'Alpha',0.05);
   end

data=zeros(10,2);
data(:,1)=svetlo;
data(:,2)=fluo;
boxplot(data,'Labels',{'Bez barviva','Nanocastice'});
ylabel('Sirka ryhy [µm]')

nazev=['p-hodnota = ',num2str(p)];
disp(nazev)
if p<0.05
    disp('Zamitame nulovou hypotezu. Kvalita detekce se lisi')
else
    disp('Nezamitame nulovou hypotezu. Kvalita detekce se nelisi')
end

%% po 24 hodinach 

clear;clc
svetlo=[0 0 2.1921 1.3504 5.2213 0 0 0 7.4846 0];
fluo=[5.6989 4.3496 5.5386 2.2588 6.9658 1.5697 0 0 5.3326 0];

[Hs,Ps]=lillietest(svetlo,'Alpha',0.05);
[Hf,Pf]=lillietest(fluo,'Alpha',0.05);

   if Hs==1 | Hf==1;
   [p,h]=signrank(svetlo,fluo,'Alpha',0.05);
   else
   [h,p]=ttest(svetlo,fluo,'Alpha',0.05);
   end

data=zeros(10,2);
data(:,1)=svetlo;
data(:,2)=fluo;
boxplot(data,'Labels',{'Bez barviva','Nanocastice'});
ylabel('Sirka ryhy [µm]')

nazev=['p-hodnota = ',num2str(p)];
disp(nazev)
if p<0.05
    disp('Zamitame nulovou hypotezu. Kvalita detekce se lisi')
else
    disp('Nezamitame nulovou hypotezu. Kvalita detekce se nelisi')
end