Demo entry 6647994

中心极限定理

   

Submitted by li on Oct 22, 2017 at 14:30
Language: Matlab. Code size: 319 Bytes.

clc;
clear all; x=zeros(10000,1); for i=1:12 
z=rand(10000,1); 
z0=max(z); 
x=x+z./z0;
end
y=x-6; 
Exp=mean(y); 
Var=var(y);
%画标准正态分布概率密度曲线
x0=-4:0.01:4;
y0=normpdf(x0,0,1);
subplot(1,2,1);
plot(x0,y0); 
title('标准高斯分布');
%画随机数概率密度曲线
[f,xi] = ksdensity(y);
subplot(1,2,2)
plot(xi,f);
title('随机数高斯分布');

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).