This commit is contained in:
2023-11-07 03:38:46 +08:00
parent 1e7c4c0e68
commit bc3890c25b
212 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
% This code is supported by the website: https://www.guanjihuan.com
% The newest version of this code is on the web page: https://www.guanjihuan.com/archives/1247
clc;clear all;clf;
s=100000; %
f=[1,2,3,3,3,3,6,5,4,3,2,1]; %
d=zeros(1,s); %
x=1;
for i=1:s
y=unidrnd(12); % 112
alpha=min(1,f(y)/f(x)); %
u=rand;
if u<alpha % alpha
x=y;
end
d(i)=x;
end
hist(d,1:1:12);