Here's another method you might consider that would allow you to directly use the 'gamrnd' and 'lognrnd' functions in the Statistics Toolbox. Suppose you want an m by n matrix, R, of random values in accordance with your mixed distribution.
U = rand(m,n)<=p;
R = U.*gamrnd(a,b,m,n)+(1-U).*lognrnd(mu,sigma,m,n);
R should have the desired distribution.
Best Answer