[184] | 1 | itload('../merger_debug.it'); |
---|
| 2 | |
---|
| 3 | ndat = 1000; % check if true! |
---|
| 4 | |
---|
[190] | 5 | XL = [-1 4]; |
---|
| 6 | YL= XL; |
---|
| 7 | |
---|
[198] | 8 | iters = 0:9 |
---|
| 9 | |
---|
[184] | 10 | figure(1); |
---|
[198] | 11 | niters = length(iters); |
---|
| 12 | noi = 1; |
---|
| 13 | for it=iters |
---|
| 14 | % figure(it+1) |
---|
| 15 | subplot(5,niters,noi); |
---|
[184] | 16 | si = num2str(it); |
---|
[190] | 17 | eval(['contour_2(Smp' si '(1,:),Smp' si '(2,:),exp(Mpdf' si '))']); |
---|
[198] | 18 | if it==iters(1), |
---|
| 19 | ylabel('Proposal density '); |
---|
| 20 | end |
---|
[190] | 21 | set(gca,'XLim',XL); |
---|
| 22 | set(gca,'YLim',YL); |
---|
[184] | 23 | |
---|
[198] | 24 | subplot(5,niters,noi+niters); |
---|
[184] | 25 | eval(['contour_2(Smp' si '(1,:),Smp' si '(2,:),exp(lW' si '(1,:)))']); |
---|
[198] | 26 | if it==iters(1), |
---|
| 27 | ylabel('First source'); |
---|
| 28 | end |
---|
[190] | 29 | set(gca,'XLim',XL); |
---|
| 30 | set(gca,'YLim',YL); |
---|
[184] | 31 | |
---|
[198] | 32 | subplot(5,niters,noi+2*niters); |
---|
[184] | 33 | eval(['contour_2(Smp' si '(1,:),Smp' si '(2,:),exp(lW' si '(2,:)))']); |
---|
[198] | 34 | if it==iters(1), |
---|
| 35 | ylabel('Second source'); |
---|
| 36 | end |
---|
[190] | 37 | set(gca,'XLim',XL); |
---|
| 38 | set(gca,'YLim',YL); |
---|
[184] | 39 | |
---|
| 40 | |
---|
[198] | 41 | subplot(5,niters,noi+3*niters); |
---|
[193] | 42 | hold off |
---|
[198] | 43 | eval(['contour_2(Smp' si '(1,:),Smp' si '(2,:),w' si ')']); |
---|
| 44 | if it==iters(1), |
---|
| 45 | ylabel('Merged density'); |
---|
| 46 | end |
---|
[190] | 47 | set(gca,'XLim',XL); |
---|
| 48 | set(gca,'YLim',YL); |
---|
[198] | 49 | |
---|
| 50 | subplot(5,niters,noi+4*niters); |
---|
| 51 | hold off |
---|
[193] | 52 | eval(['contour_2(Smp' si '(1,:),Smp' si '(2,:),w_is_' si ')']); |
---|
[198] | 53 | if it==iters(1), |
---|
| 54 | ylabel('Importance density'); |
---|
| 55 | end |
---|
| 56 | set(gca,'XLim',XL); |
---|
| 57 | set(gca,'YLim',YL); |
---|
| 58 | noi = noi+1; |
---|
[184] | 59 | end |
---|
| 60 | |
---|
[198] | 61 | for it=0:25 |
---|
| 62 | si = num2str(it); |
---|
| 63 | eval(['std_w(it+1) = std(w_is_' si '*200);']); |
---|
| 64 | eval(['prop_mean(1:2,it+1) = Mpred_mean' si ';']); |
---|
| 65 | end |
---|
[184] | 66 | |
---|
[198] | 67 | figure(2) |
---|
| 68 | subplot(1,3,1) |
---|
| 69 | hold off |
---|
| 70 | plot(std_w) |
---|
| 71 | xlabel('iteration'); |
---|
| 72 | ylabel('standard deviation'); |
---|
| 73 | title('Non-normalized importance weights') |
---|
[184] | 74 | |
---|
[198] | 75 | subplot(1,3,2); |
---|
| 76 | hist (w_is_15*200); |
---|
| 77 | title('Histogram of importance weights'); |
---|
| 78 | |
---|
| 79 | subplot(1,3,3); |
---|
[190] | 80 | hold off |
---|
[198] | 81 | plot(prop_mean'); |
---|
| 82 | hold on |
---|
| 83 | plot(ones(size(prop_mean,2),1)*[3 2],'--') |
---|
| 84 | xlabel('iteration'); |
---|
| 85 | title('Mean value of the merged density'); |
---|
| 86 | |
---|
| 87 | % itload('../merger_iter_test.it'); |
---|
| 88 | % XG = reshape(Grid(1,:),Npoints,Npoints); |
---|
| 89 | % YG = reshape(Grid(2,:),Npoints,Npoints); |
---|
| 90 | % |
---|
| 91 | % figure(2); |
---|
| 92 | % M1 = reshape(exp(Res1),Npoints,Npoints); |
---|
| 93 | % contour(XG,YG,M1,7); |
---|
| 94 | % |
---|
| 95 | % figure(3); |
---|
| 96 | % hold off |
---|
| 97 | % mm = max(max(Res2)); |
---|
| 98 | % for i=1:size(Res2,1) |
---|
| 99 | % M2 = reshape(Res2(i,:),Npoints,Npoints); |
---|
| 100 | % contour(XG,YG,M2,[0:mm/7:mm]); |
---|
| 101 | % hold on |
---|
| 102 | % end |
---|
| 103 | |
---|