root/applications/bdmtoolbox/tutorial/merging/merge_mix.m @ 1079

Revision 1079, 1.4 kB (checked in by smidl, 14 years ago)

Changes in merger + change in loading ARX

  • Property svn:eol-style set to native
Line 
1% Random Variables
2a=RV('a');
3b=RV('b');
4ab=RV({'a','b'});
5
6% Sources
7f1.class= 'enorm<ldmat>';
8f1.mu   = 3;
9f1.R    = 1;
10f1.rv   = a;
11
12f2 = struct('class','enorm<ldmat>',...
13    'mu',-3,...
14    'R',  2,...
15    'rv', a);
16
17
18% merger
19M.class='merger_mix';
20M.method='lognormal';
21M.beta=2;
22M.ncoms=20;
23M.stop_niter=5;
24M.effss_coef=1;
25%merger.dbg_file='merger_mix_dbg';
26
27% support
28support.class='rectangular_support';
29support.ranges={[-5,5]};
30support.gridsizes=[100];
31
32% 1D
33[vy]=merger({f1,f2},support,M)
34figure(1)
35hold off
36plot(vy.support,vy.weights,'.')
37hold on
38plot(vy.support,vy.source1,'.r')
39plot(vy.support,vy.source2,'.r')
40
41% wx=vy.weights;
42% [n,x]=hist(wx,15);
43% bar(x,(n.*wx)/sum(n.*wx));
44
45% 2D sources
46f3 = struct('class','enorm<ldmat>',...
47    'mu',[1,2],...
48    'R',  [2 0; 0 1.5],...
49    'rv', ab);
50f4 = struct('class','egiw',...
51    'fV',4*[5 2; 2 1],...
52    'nu',  4,...
53    'dimx',  1,...
54    'rv', ab);
55% 2D support
56support2.class='rectangular_support';
57support2.ranges={[-5,5],[0.001,5]};
58support2.gridsizes=[20,20];
59
60% 2D
61vy2=merger({f3,f4},support2,M)
62X=zeros(support2.gridsizes(1));
63Y=zeros(support2.gridsizes(1));
64Z=zeros(support2.gridsizes(1));
65
66figure(2);
67subplot(1,3,1);
68hold off
69plot(vy2.support(1,:),vy2.support(2,:),'.','MarkerSize',4)
70hold on
71contour_2(vy2.support(1,:),vy2.support(2,:),vy2.weights)
72subplot(1,3,2);
73contour_2(vy2.support(1,:),vy2.support(2,:),vy2.source1)
74subplot(1,3,3);
75contour_2(vy2.support(1,:),vy2.support(2,:),vy2.source2)
Note: See TracBrowser for help on using the browser.