root/applications/mpdm/matlab/merger_iter_debug3.m @ 706

Revision 706, 2.5 kB (checked in by smidl, 15 years ago)

eol-native

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