analysing_uncert_curves.m 4.84 KB
Newer Older
1 2 3 4
clc
clear
close all

Joanna Luberadzka's avatar
Joanna Luberadzka committed
5
addpath(genpath('../Uncertainty_Data/'));
6

7
sname='500Conv_train';
Joanna Luberadzka's avatar
Joanna Luberadzka committed
8
SNR=[Inf 5 0 -5 -10];
9
Nrtrials=20
Joanna Luberadzka's avatar
Joanna Luberadzka committed
10
Nrtrialsfull=500;
11
ax=[-90:5:90];
Joanna Luberadzka's avatar
Joanna Luberadzka committed
12
scase={'case2'}%, 'case2', 'case3'}
13
for c=1:length(scase)
Joanna Luberadzka's avatar
Joanna Luberadzka committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
    for s=1:length(SNR)
        
        matfilename= [sname,'_', scase{c}, '_SNR',num2str(SNR(s)),'N1000_test.mat'];
        load(matfilename);
        DOAentropy=zeros(Nrtrials,2);
        
        %% PLOT some of the obtained entropy curves
        for n=1:Nrtrials
            figure(c*100+s*10+1)
            subplot(3,2,1)
            plot(ax,sTEST_RESULTS.entropy{n});
            [a b]=min(sTEST_RESULTS.entropy{n});
            DOAentropy(n,:)=[a b]
            hold on
            plot(ax(b),a,'*k')
            title([sname,' ', scase{c}, ' SNR',num2str(SNR(s)),' N1000 Entropy'])
            hold all
            
            subplot(3,2,3)
            plot(ax,smooth(sTEST_RESULTS.entropy{n},10,'sgolay'))
            [a b]=min(smooth(sTEST_RESULTS.entropy{n},10,'sgolay'));
            DOAentropy_sgolay(n,:)=[a b];
            hold on
            plot(ax(b),a,'*k')
            title([sname,' ', scase{c}, ' SNR',num2str(SNR(s)),' N1000 Entropy smoothed (s.g.)'])
            hold all
            
            %         figure(s*10+3)
            %         subplot(2,1,1)
            subplot(3,2,5)
            plot(ax,smooth(sTEST_RESULTS.entropy{n},10))
            [a b]=min(smooth(sTEST_RESULTS.entropy{n},10));
            DOAentropy_movav(n,:)=[a b];
            hold on
            plot(ax(b),a,'*k')
            title([sname,' ', scase{c}, ' SNR',num2str(SNR(s)),' N1000 Entropy smoothed (m.av.)'])
            hold all
            
            %         subplot(3,2,5)
            %         plot(sTEST_RESULTS.BVSB{n});
            %         [a b]=min(sTEST_RESULTS.BVSB{n});
            %         hold on
            %         plot(b,a,'*k')
            %         title(['pilot case1 SNR',num2str(SNR(s)),'N1000 BVSB'])
            %         hold all
            %
            %         subplot(3,2,6)
            %         plot(smooth(sTEST_RESULTS.BVSB{n},10,'sgolay'))
            %         [a b]=min(smooth(sTEST_RESULTS.BVSB{n},10,'sgolay'));
            %         hold on
            %         plot(b,a,'*k')
            %         title(['pilot case1 SNR',num2str(SNR(s)),'N1000 Smoothed BVSB'])
            %         hold all
            %
        end
        
        %% ESTIMATE DOA BASED ON MINIMUM
        for n=1:Nrtrialsfull
            [a b]=min(sTEST_RESULTS.entropy{n});
            DOAentropy(n,:)=[a b]
74

Joanna Luberadzka's avatar
Joanna Luberadzka committed
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
            
            [a b]=min(smooth(sTEST_RESULTS.entropy{n},10,'sgolay'));
            DOAentropy_sgolay(n,:)=[a b];
            
            [a b]=min(smooth(sTEST_RESULTS.entropy{n},10));
            DOAentropy_movav(n,:)=[a b];
        end
        
        
        %% ESTIMATION MEASURES
        
            Measures_entropy(1)=median(ax(DOAentropy(:,2)));
            Measures_entropy(2)=sqrt((1/length(DOAentropy(:,2)))*(sum((-30-ax(DOAentropy(:,2))).^2)));
            Measures_entropy(3)=length(   find(ax(DOAentropy(:,2))+30<=5) )./length(DOAentropy(:,2));
            
            Measures_entropy_sgolay(1)=median(ax(DOAentropy_sgolay(:,2)));
            Measures_entropy_sgolay(2)=sqrt((1/length(DOAentropy_sgolay(:,2)))*(sum((-30-ax(DOAentropy_sgolay(:,2))).^2))) ;
            Measures_entropy_sgolay(3)=length(   find(ax(DOAentropy_sgolay(:,2))+30<=5)   )./length(DOAentropy_sgolay(:,2));
            
            Measures_entropy_movav(1)=median(ax(DOAentropy_movav(:,2)));
            Measures_entropy_movav(2)=sqrt((1/length(DOAentropy_movav(:,2)))*(sum((-30-ax(DOAentropy_movav(:,2))).^2))) ;
            Measures_entropy_movav(3)=length(   find( ax(DOAentropy_movav(:,2))+30<=5)   )./length(DOAentropy_movav(:,2));
97

Joanna Luberadzka's avatar
Joanna Luberadzka committed
98 99 100 101 102 103 104
        
        
        
        
        
        
        %% PLOT ESTIMATION RESULTS
105
        figure(c*100+s*10+1)
106
        Nrtrialsfull=500;
Joanna Luberadzka's avatar
Joanna Luberadzka committed
107 108 109 110 111 112
        subplot(3,2,2)
        hist(ax(DOAentropy(:,2)),-90:5:90)
        axis([-90 90 0 Nrtrialsfull])
        axi=gca;
        set(axi,'XTick',[-90 -30 0 30 90])
        title(['MEDIAN=',num2str(Measures_entropy(1)),'°; RMSE=',num2str(Measures_entropy(2)),'; GA=',num2str(Measures_entropy(3)*100),'%'])
113
        
Joanna Luberadzka's avatar
Joanna Luberadzka committed
114 115 116 117 118 119
        subplot(3,2,4)
        hist(ax(DOAentropy_sgolay(:,2)),-90:5:90)
        axis([-90 90 0 Nrtrialsfull])
        axi=gca;
        set(axi,'XTick',[-90 -30 0 30 90])
        title(['MEDIAN=',num2str(Measures_entropy_movav(1)),'°; RMSE=',num2str(Measures_entropy_movav(2)),'; GA=',num2str(Measures_entropy_movav(3)*100),'%'])
120
        
Joanna Luberadzka's avatar
Joanna Luberadzka committed
121 122 123 124 125 126 127
        subplot(3,2,6)
        hist(ax(DOAentropy_movav(:,2)),-90:5:90)
        axis([-90 90 0 Nrtrialsfull])
        axi=gca;
        set(axi,'XTick',[-90 -30 0 30 90])
        title(['MEDIAN=',num2str(Measures_entropy_sgolay(1)),'°; RMSE=',num2str(Measures_entropy_sgolay(2)),'; GA=',num2str(Measures_entropy_sgolay(3)*100),'%'])

128 129 130 131
        
    end
end