From: kumar vishwajeet on
The following code draws histogram for Probability density function(pdf):-

mean1 = -0.5;
mean2 = 0.5;
var1 = 0.1;
var2 = 1;
z=linspace(-10,10,10000);
pdf1=mean1+sqrt(var1).*randn(1,10000);
pdf2=mean2+sqrt(var2).*randn(1,10000);
pdf(1,:)=0.1.*pdf1+0.9.*pdf2;
hist(pdf(1,:),z);

Now I want to repeat these steps for different time steps because after every 1 second mean and variance(var) changes for the given data. I want to draw histogram for 20 seconds all in the same figure. Thus 2d histogram has to be drawn in 3d space. How can I do it??

Thanks.