xyhisto.m

来自「一些常被用于教学或者参考的概率论的实例的源代码」· M 代码 · 共 19 行

M
19
字号
%xyhisto.m/created by PJNahin for "Duelling Idiots"(1/6/99)
%This m-file produces 20,000 values of X raised to the Y power,
%where X and Y are both uniform from 0 to 1, and independent. It
%then plots a histogram of the values using 100 bins.
%
%
rand('state',100*sum(clock))
clear z
for pair = 1:20000
   x=rand;
   y=rand;
   z(pair)=x^y;
end
hist(z,100)
xlabel('z')
ylabel('number of values per bin')
title('Fig.13.3 - Histogram of X^Y (20,000 values)')
figure(1)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?