我使用简单随机抽样和拉丁超立方抽样来找到两种方法之间的差异,因为我们计算图像的1个像素的变量,并查看均值和方差的2种方法的差异。迭代次数为1000,样本数(N)为[10 30 50 100]。有人知道如何在同一代码中为2个像素或更多像素制作相同的内容吗?
我的代码示例是(其中'uniform'代表LH,'random'代表SR):
m = 0; % zero mean
s = 1; % unit standard deviation
Fx = (0.001:0.001:0.999)'; % discretize probability axis
N = 10 % sample size
seedNum = 34567; % random number generator
rng(seedNum); % set random number seed
nIter = 1000 % number of iterations or repetitions of sampling
xSR10 = lhsunivar('normal',N,'random',nIter,m,s);
disp(xSR10)
MeanxSR10 = mean(xSR10);
disp (MeanxSR10);
xLH10 = lhsunivar('normal',N,'uniform',nIter,m,s);
disp (xLH10);
MeanxLH10 = mean(xLH10);
disp (MeanxLH10);