source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/lightspeed/randbeta.m @ 86

Last change on this file since 86 was 37, checked in by (none), 15 years ago

Added original make3d

File size: 449 bytes
Line 
1function x = randbeta(a,b)
2% RANDBETA   Sample from Beta distribution
3%
4% X = RANDBETA(A,B) returns a matrix, the same size as A and B, where X(i,j)
5% is sampled from a Beta(A(i,j),B(i,j)) distribution.
6% A or B can be scalar when the other is a matrix, otherwise they must be
7% the same size.
8
9if length(a) == 1
10  a = repmat(a,size(b));
11elseif length(b) == 1
12  b = repmat(b,size(a));
13end
14x = randgamma(a);
15x = x./(x + randgamma(b));
Note: See TracBrowser for help on using the repository browser.