Mercurial > hg > ltpda
comparison m-toolbox/classes/+utils/@math/fitPrior.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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
2 % Function fitpriors fits the pdf computed from a pest object. % | |
3 % It returns matrix (# of params x 3) with the mean, sigma and % | |
4 % normalization constant for each parameter at each column. -Nikos- % | |
5 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
6 function params = fitPrior(prior,nparam,chain,bins) | |
7 params = []; | |
8 | |
9 for ii=1:nparam | |
10 x = linspace(min(prior(:,2*ii-1)),max(prior(:,2*ii-1)),bins); | |
11 y = normpdf(x,mean(chain(:,ii)),std(chain(:,ii))); | |
12 s=sum(y); | |
13 params(ii,:) = [mean(chain(:,ii)) std(chain(:,ii)) s]; | |
14 end | |
15 end |