comparison m-toolbox/test/test_ao_metropolis.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % A test script for ao/metropolis
2 %
3 % M Nofrarias 17-03-09
4 %
5 % $Id: test_ao_metropolis.m,v 1.1 2009/03/18 14:00:13 miquel Exp $
6 %
7
8 %% Make gaussian distribution
9
10 gauss = ao(plist('xyfcn','1/(sqrt(2*pi)*2)*exp(-(x-5).^2./(2*2^2))','x',(-10:.01:20)))
11 gauss.setName('gaussian pdf')
12
13 %% Sample the distribution
14
15 pl = plist('N',500,'J',2,'sigma',2,'range',[0 1]);
16 b = metropolis(gauss,pl)
17
18 % compute histogram
19 c = hist(b,plist('N',15));
20 prob = c./len(b(1))./(c(1).x(2)-c(1).x(1))
21 prob.setName('histogram')
22
23 %% Plot
24 iplot(gauss,prob,plist('LineStyles',{'-','--','--'},'Function','stairs'))
25
26
27