comparison examples/SMALL_test_coherence2.m @ 183:0d7a81655ef2 danieleb

removed cumulative coherence calculation
author Daniele Barchiesi <daniele.barchiesi@eecs.qmul.ac.uk>
date Fri, 27 Jan 2012 13:15:11 +0000
parents dc2f0fa21310
children
comparison
equal deleted inserted replaced
182:f8bc99a5470c 183:0d7a81655ef2
1 %
2 %
3 %
4
1 clc, clear, close all 5 clc, clear, close all
2 6
3 %% Parameteres 7 %% Parameteres
4 nTrials = 10; %number of trials of the experiment 8 nTrials = 10; %number of trials of the experiment
5 9
69 end 73 end
70 end 74 end
71 75
72 %% Evaluate coherence and snr of representation for the various methods 76 %% Evaluate coherence and snr of representation for the various methods
73 sr = zeros(size(SMALL.DL)); %signal to noise ratio 77 sr = zeros(size(SMALL.DL)); %signal to noise ratio
74 mu = zeros(nTrials,nInitDicts,nCorrLevels,nDecorrAlgs,blockSize); %cumulative coherence 78 mu1 = zeros(nTrials,nInitDicts,nCorrLevels,nDecorrAlgs,blockSize); %cumulative coherence
79 mu2 = zeros(nTrials,nInitDicts,nCorrLevels,nDecorrAlgs,blockSize); %cumulative coherence
75 dic(size(SMALL.DL)) = dictionary; %initialise dictionary objects 80 dic(size(SMALL.DL)) = dictionary; %initialise dictionary objects
76 for iTrial=1:nTrials 81 for iTrial=1:nTrials
77 for iInitDicts=1:nInitDicts 82 for iInitDicts=1:nInitDicts
78 for iCorrLevels=1:nCorrLevels 83 for iCorrLevels=1:nCorrLevels
79 for iDecorrAlgs=1:nDecorrAlgs 84 for iDecorrAlgs=1:nDecorrAlgs
84 sr(iTrial,iInitDicts,iCorrLevels,iDecorrAlgs) = ... 89 sr(iTrial,iInitDicts,iCorrLevels,iDecorrAlgs) = ...
85 snr(SMALL.Problem.b,SMALL.DL(iTrial,iInitDicts,iCorrLevels,iDecorrAlgs).D*tempSolver.solution); 90 snr(SMALL.Problem.b,SMALL.DL(iTrial,iInitDicts,iCorrLevels,iDecorrAlgs).D*tempSolver.solution);
86 %calculate mu 91 %calculate mu
87 dic(iTrial,iInitDicts,iCorrLevels,iDecorrAlgs) = ... 92 dic(iTrial,iInitDicts,iCorrLevels,iDecorrAlgs) = ...
88 dictionary(SMALL.DL(iTrial,iInitDicts,iCorrLevels,iDecorrAlgs).D); 93 dictionary(SMALL.DL(iTrial,iInitDicts,iCorrLevels,iDecorrAlgs).D);
89 mu(iTrial,iInitDicts,iCorrLevels,iDecorrAlgs,:) = ... 94 mu1(iTrial,iInitDicts,iCorrLevels,iDecorrAlgs,:) = ...
90 dic(iTrial,iInitDicts,iCorrLevels,iDecorrAlgs).cumcoherence; 95 dic(iTrial,iInitDicts,iCorrLevels,iDecorrAlgs).cumcoherence;
96 mu2(iTrial,iInitDicts,iCorrLevels,iDecorrAlgs,:) = ...
97 dic(iTrial,iInitDicts,iCorrLevels,iDecorrAlgs).cumcoherence(2);
91 end 98 end
92 end 99 end
93 end 100 end
94 end 101 end
95 102
96 %% Plot results 103 %% Plot results
97 minMu = sqrt((dictSize-blockSize)/(blockSize*(dictSize-1))); %lowe bound on coherence 104 minMu = sqrt((dictSize-blockSize)/(blockSize*(dictSize-1))); %lowe bound on coherence
98 initDictsNames = {'Data','Gabor'}; 105 initDictsNames = {'Data','Gabor'};
99 dicDecorrNames = {'IPR','INK-SVD','IP'}; 106 dicDecorrNames = {'IPR','INK-SVD'};
100 lineStyles = {'k.-','r*-','b+-'}; 107 lineStyles = {'k.-','r*-','b+-'};
101 for iInitDict=1:nInitDicts 108 for iInitDict=1:nInitDicts
102 figure, hold on, grid on 109 figure, hold on, grid on
103 title([initDictsNames{iInitDict} ' Initialisation']); 110 title([initDictsNames{iInitDict} ' Initialisation']);
104 plot([1 1],[0 25],'k-'); 111 plot([1 1],[0 25],'k-');
105 for iDecorrAlgs=1:nDecorrAlgs 112 for iDecorrAlgs=1:nDecorrAlgs-1
106 coherenceLevels = squeeze(mean(mu(:,iInitDict,:,iDecorrAlgs,1),1)); 113 coherenceLevels = squeeze(mean(mu(:,iInitDict,:,iDecorrAlgs,1),1));
107 meanSNRs = squeeze(mean(sr(:,iInitDict,:,iDecorrAlgs),1)); 114 meanSNRs = squeeze(mean(sr(:,iInitDict,:,iDecorrAlgs),1));
108 stdSNRs = squeeze(std(sr(:,iInitDict,:,iDecorrAlgs),0,1)); 115 stdSNRs = squeeze(std(sr(:,iInitDict,:,iDecorrAlgs),0,1));
109 errorbar(coherenceLevels,meanSNRs,stdSNRs,lineStyles{iDecorrAlgs}); 116 errorbar(coherenceLevels,meanSNRs,stdSNRs,lineStyles{iDecorrAlgs});
110 end 117 end
113 set(gca,'YLim',[0 25],'XLim',[0 1.4]); 120 set(gca,'YLim',[0 25],'XLim',[0 1.4]);
114 legend([{'\mu_{max}'},dicDecorrNames,{'\mu_{min}'}]); 121 legend([{'\mu_{max}'},dicDecorrNames,{'\mu_{min}'}]);
115 xlabel('\mu'); 122 xlabel('\mu');
116 ylabel('SNR (dB)'); 123 ylabel('SNR (dB)');
117 end 124 end
125
126 %%
127 mu2 = squeeze(mean(mu2,1));
128 mu = squeeze(mean(mu,1));