% Hodnoceni vlivu barviv na rychlost bunecne migrace
% 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

%% srovnani hned po vytvoreni ryhy

clear;clc;
data=zeros(10,3);
origin=[624.8324 550.8783 689.5697 529.1481 631.6112 531.3858 550.3038 546.3984 556.0617 513.5845];
CMFDA=[591.9328 590.1782 621.1976 579.7123 513.5433 546.0411 595.6667 516.98 531.4526 537.5579];
NP=[492.0291 535.2378 571.1456 554.5888 512.4946 593.5537 711.1474 481.7558 535.1287 611.6512];

data(:,1)=origin;
data(:,2)=CMFDA;
data(:,3)=NP;
group={'Bez barviva','CMFDA','Nanocastice'};

fig5=figure;
set(fig5,'Position',[260,90,850,550],'Name','Hodnoceni vlivu barviv na rychlost migrace','NumberTitle','off');
boxplot(data,'Labels',group);
ylabel('Sirka ryhy [µm]')

prumer_origin=mean(origin);
prumer_CMFDA=mean(CMFDA);
prumer_NP=mean(NP);

F_test=vartestn(data,'display','off')

[p,tbl,stats]=anova1(data,group);
a=multcompare(stats);

nazev=['p-hodnota = ',num2str(p)];
disp(nazev)
if p<0.05
    disp('Zamitame nulovou hypotezu. Sirka ryhy ve vsech testech se lisi')
else
    disp('Nezamitame nulovou hypotezu. Sirka ryhy ve vsech testech se nelisi')
end


%% po 17 hodinach

clear;clc
data=zeros(10,3);
origin=[276.6181 186.4624 378.8975 374.2707 456.7259 311.6453 292.0871 236.3084 346.4297 234.0128];
CMFDA=[424.1846 478.9458 361.97 402.2886 261.2815 350.5734 349.8965 263.2899 198.8098 270.7545];
NP=[271.5504 259.4413 363.6121 275.025 185.2956 342.8483 465.395 194.763 284.3153 295.9914];

data(:,1)=origin;
data(:,2)=CMFDA;
data(:,3)=NP;
group={'Bez barviva','CMFDA','Nanocastice'};

fig5=figure;
set(fig5,'Position',[260,90,850,550],'Name','Hodnoceni vlivu barviv na rychlost migrace','NumberTitle','off');
boxplot(data,'Labels',group);
ylabel('Sirka ryhy [µm]')

prumer_origin=mean(origin);
prumer_CMFDA=mean(CMFDA);
prumer_NP=mean(NP);

F_test=vartestn(data,'display','off')

[p,tbl,stats]=anova1(data,group);
a=multcompare(stats);

nazev=['p-hodnota = ',num2str(p)];
disp(nazev)
if p<0.05
    disp('Zamitame nulovou hypotezu. Sirka ryhy ve vsech testech se lisi')
else
    disp('Nezamitame nulovou hypotezu. Sirka ryhy ve vsech testech se nelisi')
end


%% po 40 hodinach

clear;clc
data=zeros(10,3);
origin=[1.4595 0 0 27.7185 6.0362 9.9071 45.58 7.1428 10.4214 12.009];
CMFDA=[56.3053 24.0725 0 1.5486 0 8.7448 4.5734 0 0 11.341];
NP=[5.5508 3.0359 62.4907 0 6.5628 0 14.5528 0 0 0];

data(:,1)=origin;
data(:,2)=CMFDA;
data(:,3)=NP;
group={'Bez barviva','CMFDA','Nanocastice'};

fig5=figure;
set(fig5,'Position',[260,90,850,550],'Name','Hodnoceni vlivu barviv na rychlost migrace','NumberTitle','off');
boxplot(data,'Labels',group);
ylabel('Sirka ryhy [µm]')

prumer_origin=mean(origin);
prumer_CMFDA=mean(CMFDA);
prumer_NP=mean(NP);

F_test=vartestn(data,'display','off')

[p,tbl,stats]=anova1(data,group);
a=multcompare(stats);
   
nazev=['p-hodnota = ',num2str(p)];
disp(nazev)
if p<0.05
    disp('Zamitame nulovou hypotezu. Sirka ryhy ve vsech testech se lisi')
else
    disp('Nezamitame nulovou hypotezu. Sirka ryhy ve vsech testech se nelisi')
end


%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Dve serii

%% srovnani hned po vytvoreni ryhy

clear;clc;
data=zeros(10,3);
origin=[473.827 388.0787 460.5422 346.5188 432.6523 391.6668 368.9893 354.9708 461.5152 392.4584];
CMFDA=[420.9817 337.6237 412.8147 395.7826 371.0477 398.5291 425.3903 350.6379 383.4052 384.7322];
NP=[379.414 425.5351 445.2735 463.5202 480.1883 395.0033 460.7804 373.7129 503.2054 355.5308];

data(:,1)=origin;
data(:,2)=CMFDA;
data(:,3)=NP;
group={'Bez barviva','CMFDA','Nanocastice'};

fig5=figure;
set(fig5,'Position',[260,90,850,550],'Name','Hodnoceni vlivu barviv na rychlost migrace','NumberTitle','off');
boxplot(data,'Labels',group);
ylabel('Sirka ryhy [µm]')

prumer_origin=mean(origin);
prumer_CMFDA=mean(CMFDA);
prumer_NP=mean(NP);

F_test=vartestn(data,'display','off')

[p,tbl,stats]=anova1(data,group);
a=multcompare(stats);

nazev=['p-hodnota = ',num2str(p)];
disp(nazev)
if p<0.05
    disp('Zamitame nulovou hypotezu. Sirka ryhy ve vsech testech se lisi')
else
    disp('Nezamitame nulovou hypotezu. Sirka ryhy ve vsech testech se nelisi')
end


%% po 24 hodinach

clear;clc;
data=zeros(10,3);
origin=[10.162 7.0582 0 0 6.0562 1.3337 0 0 5.2937 3.7262];
CMFDA=[0 0 1.4361 3.0649 0 2.093 8.9063 0 10.2934 9.8637];
NP=[0 0 2.1921 1.3504 5.2213 0 0 0 7.4846 0];

data(:,1)=origin;
data(:,2)=CMFDA;
data(:,3)=NP;
group={'Bez barviva','CMFDA','Nanocastice'};

fig5=figure;
set(fig5,'Position',[260,90,850,550],'Name','Hodnoceni vlivu barviv na rychlost migrace','NumberTitle','off');
boxplot(data,'Labels',group);
ylabel('Sirka ryhy [µm]')

prumer_origin=mean(origin);
prumer_CMFDA=mean(CMFDA);
prumer_NP=mean(NP);

F_test=vartestn(data,'display','off')

[p,tbl,stats]=anova1(data,group);
a=multcompare(stats);

nazev=['p-hodnota = ',num2str(p)];
disp(nazev)
if p<0.05
    disp('Zamitame nulovou hypotezu. Sirka ryhy ve vsech testech se lisi')
else
    disp('Nezamitame nulovou hypotezu. Sirka ryhy ve vsech testech se nelisi')
end
