Changeset 198 for matlab

Show
Ignore:
Timestamp:
11/04/08 14:54:34 (16 years ago)
Author:
smidl
Message:

opravy + zavedeni studenta + zakomentovani debug v mergeru

Location:
matlab
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • matlab/contour_2.m

    r194 r198  
    77 % 
    88 if nargin<4 
    9      contour(X,Y,Z) 
     9     contour(X,Y,Z,7) 
    1010 else 
    1111     contour(X,Y,Z,str) 
  • matlab/merger_iter_debug.m

    r193 r198  
    66YL= XL; 
    77 
     8iters = 0:9 
     9 
    810figure(1); 
    9 for it=0:4 
    10     figure(it+1) 
    11     subplot(2,2,1); 
     11niters = length(iters); 
     12noi = 1; 
     13for it=iters 
     14%    figure(it+1) 
     15    subplot(5,niters,noi); 
    1216    si = num2str(it); 
    1317    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 
    1521    set(gca,'XLim',XL); 
    1622    set(gca,'YLim',YL); 
    1723         
    18     subplot(2,2,2); 
     24    subplot(5,niters,noi+niters); 
    1925    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 
    2129    set(gca,'XLim',XL); 
    2230    set(gca,'YLim',YL); 
    2331     
    24     subplot(2,2,3); 
     32    subplot(5,niters,noi+2*niters); 
    2533    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 
    2837    set(gca,'XLim',XL); 
    2938    set(gca,'YLim',YL); 
    3039     
    3140     
    32     subplot(2,2,4); 
     41    subplot(5,niters,noi+3*niters); 
    3342    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 
    3647    set(gca,'XLim',XL); 
    3748    set(gca,'YLim',YL); 
    38     hold on 
     49     
     50    subplot(5,niters,noi+4*niters); 
     51    hold off 
    3952    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; 
    4159end 
    4260 
    43     
    44 itload('../merger_iter_test.it'); 
    45 XG = reshape(Grid(1,:),Npoints,Npoints); 
    46 YG = reshape(Grid(2,:),Npoints,Npoints); 
     61for 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 ';']); 
     65end 
    4766 
    48 figure(it+2); 
    49 M1 = reshape(exp(Res1),Npoints,Npoints); 
    50 contour(XG,YG,M1,7); 
     67figure(2) 
     68subplot(1,3,1) 
     69hold off 
     70plot(std_w) 
     71xlabel('iteration'); 
     72ylabel('standard deviation'); 
     73title('Non-normalized importance weights') 
    5174 
    52 figure(it+3); 
     75subplot(1,3,2); 
     76hist (w_is_15*200); 
     77title('Histogram of importance weights'); 
     78 
     79subplot(1,3,3); 
    5380hold 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 
     81plot(prop_mean'); 
     82hold on 
     83plot(ones(size(prop_mean,2),1)*[3 2],'--') 
     84xlabel('iteration'); 
     85title('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