📄 z.m
字号:
%z.m/created by PJNahin for "Duelling Idiots"(2/15/99)
%This m-file simulates the random variable Z=X/(X-Y),
%where X and Y are independent and uniform from 0 to 1.
%The output is a histogram of Z.
%
%
rand('state',100*sum(clock));
x=-3:.05:3;
index=10000;
while index>0
X=rand;
Y=rand;
Z=X/(X-Y);
if abs(Z)<3
vector(index)=Z;
index=index-1;
end
end
hist(vector,x)
title('Fig.12.4 - Histogram of Z=X/(X-Y)')
xlabel('z, in bins of width 0.05')
ylabel('number of numbers in each bin')
figure(1)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -