%minimax.m
close all
y=[1 1];
z=2;
len=1000;
priorprob{1}=[0.8 0.7];
priorprob{2}=[0.4 0.8];
priorprob{3}=[0.7 0.2];
priorprob{4}=[0.4 0.2];
pfa=[];
for i=1:1:4
x=priorprob{i};
pdcol_before=[];
pfacol_before=[];
pdcol_after=[];
pfacol_after=[];
for p0=[0.1:1/1000:0.9]
[datatx,datarx,datadetected,bayesruleselected,pl,ph,val_pl,val_ph,...
pd,gamma,pd_obtained_beforedetection,pfa_obtained_beforedetection,...
pd_obtained_afterdetection,pfa_obtained_afterdetection]...
=binarychanneldetection(x,y,z,len,p0,pfa);
pdcol_before=[pdcol_before pd_obtained_beforedetection];
pfacol_before=[pfacol_before pfa_obtained_beforedetection];
pdcol_after=[pdcol_after pd_obtained_afterdetection];
pfacol_after=[pfacol_after pfa_obtained_afterdetection];
end
pdcol_beforefinal{i}=pdcol_before;
pfacol_beforefinal{i}=pfacol_before;
pdcol_afterfinal{i}=pdcol_after;
pfacol_afterfinal{i}=pfacol_after;
end
for i=1:1:4
figure(2*(i-1)+2)
plot(pfacol_beforefinal{i},pdcol_beforefinal{i},'*')
figure(2*(i-1)+3)
plot(pfacol_afterfinal{i},pdcol_afterfinal{i},'*')
end