0

I use Simple Random Sampling and Latin Hypercube Sampling in order to find the differences between the 2 methods as we calculate the variable for 1 pixel of an image and see the differences for the 2 methods of the Means and Variances. The number of Iterations is 1000 and the number of Samples (N) is [10 30 50 100].Does anyone knows how can i make the same for 2 pixels or more at the same code?

A sample of my code is (where 'uniform' is for LH and 'random' for 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); 
Loukas K.
  • 1
  • 3
  • 2
    Welcome to SO! Please consider adding some information to this question. Preferably a small sample code showing what you have working for 1 pixel. – Stewie Griffin Jan 02 '14 at 16:48
  • Either you can call your function twice, and post process the results. Or you can make sure your function accepts vectors as input. The latter is typically preferable, and usually this is not very hard in matlab. Consider `x=1:3;M=magic(5);x.^2,mean(M(x)), var(M(x)` – Dennis Jaheruddin Jan 02 '14 at 16:57
  • Thank you for your immediate response.I put a sample of my code if it's helpful. – Loukas K. Jan 02 '14 at 17:38

0 Answers0