- Timestamp:
- 11/04/08 14:54:34 (16 years ago)
- Location:
- matlab
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
matlab/contour_2.m
r194 r198 7 7 % 8 8 if nargin<4 9 contour(X,Y,Z )9 contour(X,Y,Z,7) 10 10 else 11 11 contour(X,Y,Z,str) -
matlab/merger_iter_debug.m
r193 r198 6 6 YL= XL; 7 7 8 iters = 0:9 9 8 10 figure(1); 9 for it=0:4 10 figure(it+1) 11 subplot(2,2,1); 11 niters = length(iters); 12 noi = 1; 13 for it=iters 14 % figure(it+1) 15 subplot(5,niters,noi); 12 16 si = num2str(it); 13 17 eval(['contour_2(Smp' si '(1,:),Smp' si '(2,:),exp(Mpdf' si '))']); 14 title('Proposal density '); 18 if it==iters(1), 19 ylabel('Proposal density '); 20 end 15 21 set(gca,'XLim',XL); 16 22 set(gca,'YLim',YL); 17 23 18 subplot( 2,2,2);24 subplot(5,niters,noi+niters); 19 25 eval(['contour_2(Smp' si '(1,:),Smp' si '(2,:),exp(lW' si '(1,:)))']); 20 title('First source'); 26 if it==iters(1), 27 ylabel('First source'); 28 end 21 29 set(gca,'XLim',XL); 22 30 set(gca,'YLim',YL); 23 31 24 subplot( 2,2,3);32 subplot(5,niters,noi+2*niters); 25 33 eval(['contour_2(Smp' si '(1,:),Smp' si '(2,:),exp(lW' si '(2,:)))']); 26 %eval(['contour_2(Smp' si '(1,:),Smp' si '(2,:),exp(lw_cond' si '))']); 27 title('Second source'); 34 if it==iters(1), 35 ylabel('Second source'); 36 end 28 37 set(gca,'XLim',XL); 29 38 set(gca,'YLim',YL); 30 39 31 40 32 subplot( 2,2,4);41 subplot(5,niters,noi+3*niters); 33 42 hold off 34 eval(['contour_2(Smp' si '(1,:),Smp' si '(2,:),w' si ','':'')']); 35 title('Merged density'); 43 eval(['contour_2(Smp' si '(1,:),Smp' si '(2,:),w' si ')']); 44 if it==iters(1), 45 ylabel('Merged density'); 46 end 36 47 set(gca,'XLim',XL); 37 48 set(gca,'YLim',YL); 38 hold on 49 50 subplot(5,niters,noi+4*niters); 51 hold off 39 52 eval(['contour_2(Smp' si '(1,:),Smp' si '(2,:),w_is_' si ')']); 40 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; 41 59 end 42 60 43 44 itload('../merger_iter_test.it'); 45 XG = reshape(Grid(1,:),Npoints,Npoints); 46 YG = reshape(Grid(2,:),Npoints,Npoints); 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 47 66 48 figure(it+2); 49 M1 = reshape(exp(Res1),Npoints,Npoints); 50 contour(XG,YG,M1,7); 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') 51 74 52 figure(it+3); 75 subplot(1,3,2); 76 hist (w_is_15*200); 77 title('Histogram of importance weights'); 78 79 subplot(1,3,3); 53 80 hold off 54 mm = max(max(Res2)); 55 for i=1:size(Res2,1) 56 M2 = reshape(Res2(i,:),Npoints,Npoints); 57 contour(XG,YG,M2,[0:mm/7:mm]); 58 hold on 59 end 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