一些常被用于教学或者参考的概率论的实例的源代码

源代码在线查看: z.m

软件大小: 30 K
上传用户: chmqn
关键词: 概率论 源代码
下载地址: 免注册下载 普通下载 VIP

相关代码

				%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)				      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)			

相关资源