Index: matlab/mixef_test.m
===================================================================
--- matlab/mixef_test.m (revision 202)
+++ matlab/mixef_test.m (revision 202)
@@ -0,0 +1,12 @@
+itload('../mixef_test.it');
+
+figure(1);
+hold off;
+plot(Smp(1,:), Smp(2,:),'.');
+hold on
+xv=-5:0.1:5;
+X = ones(size(xv))'*xv;
+Y = xv'*ones(size(xv));
+
+contour(X,Y,PPdf)
+
Index: matlab/merger_iter_debug3.m
===================================================================
--- matlab/merger_iter_debug3.m (revision 202)
+++ matlab/merger_iter_debug3.m (revision 202)
@@ -0,0 +1,114 @@
+itload('../merger_debug.it');
+
+ndat = 1000; % check if true!
+
+XL = [-1 4];
+YL= XL;
+
+iters = 0%:2:20
+
+figure(1);
+niters = length(iters);
+noi = 1;
+for it=iters
+%    figure(it+1)
+    subplot(6,niters,noi);
+    si = num2str(it);
+    eval(['contour_2(Smp' si '(1,:),Smp' si '(2,:),exp(Mpdf' si '))']);
+    if it==iters(1),
+    ylabel('Proposal density ');
+    end
+    set(gca,'XLim',XL);
+    set(gca,'YLim',YL);
+        
+    subplot(6,niters,noi+niters);
+    eval(['contour_2(Smp' si '(1,:),Smp' si '(2,:),exp(lW' si '(1,:)))']);
+    if it==iters(1),
+    ylabel('First source'); 
+    end
+    set(gca,'XLim',XL);
+    set(gca,'YLim',YL);
+    
+    subplot(6,niters,noi+2*niters);
+    eval(['contour_2(Smp' si '(1,:),Smp' si '(2,:),exp(lW' si '(2,:)))']);
+    if it==iters(1),
+    ylabel('Second source');
+    end
+    set(gca,'XLim',XL);
+    set(gca,'YLim',YL);
+
+    subplot(6,niters,noi+3*niters);
+    eval(['contour_2(Smp' si '(1,:),Smp' si '(2,:),exp(lW' si '(3,:)))']);
+    if it==iters(1),
+    ylabel('Third source');
+    end
+    set(gca,'XLim',XL);
+    set(gca,'YLim',YL);
+    
+    
+    subplot(6,niters,noi+4*niters);
+    hold off
+    eval(['contour_2(Smp' si '(1,:),Smp' si '(2,:),w' si ')']);
+    if it==iters(1),
+    ylabel('Merged density'); 
+    end
+    set(gca,'XLim',XL);
+    set(gca,'YLim',YL);
+    
+    subplot(6,niters,noi+5*niters);
+    hold off
+    eval(['contour_2(Smp' si '(1,:),Smp' si '(2,:),w_is_' si ')']);
+    if it==iters(1),
+    ylabel('Importance density'); 
+    end
+    set(gca,'XLim',XL);
+    set(gca,'YLim',YL);
+    noi = noi+1;
+end
+
+for it=0:25
+    si = num2str(it);
+    eval(['std_w(it+1) = std(w_is_' si '*200);']);
+    eval(['prop_mean(1:2,it+1) = Mpred_mean' si ';']);
+    eval(['merg_mean(1:3,it+1) = sum((ones(3,1)*(w' si '/sum(w' si '))'').*Smp' si ',2);']);
+end
+
+figure(2)
+subplot(1,3,1)
+hold off
+plot(std_w)
+xlabel('iteration');
+ylabel('standard deviation');
+title('Non-normalized importance weights')
+
+subplot(1,3,2);
+hist (w_is_15*400);
+title('Histogram of importance weights');
+
+subplot(1,3,3);
+hold off
+plot(prop_mean');
+hold on
+plot(merg_mean(1:2,:)','--');
+%plot(ones(size(prop_mean,2),1)*[3 2],'--')
+hold on
+xlabel('iteration');
+title('Mean value of the merged density');
+
+% itload('../merger_iter_test.it');
+% XG = reshape(Grid(1,:),Npoints,Npoints);
+% YG = reshape(Grid(2,:),Npoints,Npoints);
+% 
+% figure(2);
+% M1 = reshape(exp(Res1),Npoints,Npoints);
+% contour(XG,YG,M1,7);
+% 
+% figure(3);
+% hold off
+% mm = max(max(Res2));
+% for i=1:size(Res2,1)
+%     M2 = reshape(Res2(i,:),Npoints,Npoints);
+%     contour(XG,YG,M2,[0:mm/7:mm]);
+%     hold on
+% end
+
Index: matlab/merger_test.m
===================================================================
--- matlab/merger_test.m (revision 202)
+++ matlab/merger_test.m (revision 202)
@@ -0,0 +1,19 @@
+itload('../merger_test_1000.it');
+
+ndat = 1000; % check if true!
+
+xstep = x_grid(2)-x_grid(1);
+
+figure(1);
+subplot(1,2,1);
+hold off
+plot(x_grid,exp(mm2)/sum(exp(mm2))/xstep,'--')
+hold on
+plot(x_grid,m2/sum(m2)/xstep)
+
+subplot(1,2,2);
+hold off
+itload('../merger_test.it');
+plot(x_grid,exp(mm2)/sum(exp(mm2))/xstep,'--')
+hold on
+plot(x_grid,m2/sum(m2)/xstep)
Index: matlab/emix_test.m
===================================================================
--- matlab/emix_test.m (revision 202)
+++ matlab/emix_test.m (revision 202)
@@ -0,0 +1,5 @@
+itload('../emix_test.it');
+
+figure(1);
+hold off;
+plot(Smp(1,:), Smp(2,:),'.');
