lundi 6 février 2023

Generate random samples using Latin Hypercube Sampling

I want my MATLAB code to generate the random samples of uncertainties in the three parameters (155, 189, 232) using Latin Hypercube sampling which has 10 % relative uncertainties. The maximum and minimum uncertainity should cover more than 90 % of the of the distribution probability that is two standard derivation. Below is my MATLAB code, please check if I am on the right path.

% Define the measurements values and their relative uncertainty
measurement = [155, 189, 232];
relative_uncertainty = 0.10;
% Calculate the uncertainty range for each measurements
measurement_range = coefficient .* relative_uncertainty;
% Set the number of samples to generate
n_samples = 10;
% Generate the random samples using Latin Hypercube Sampling
lhs = lhsdesign(n_samples, length(measurement));
lhs = bsxfun(@plus,measurement - measurement_range, bsxfun(@times, lhs, 2 * measurement_range));
% Write the results to a CSV file
csvwrite('measurement_samples.csv', lhs);



Aucun commentaire:

Enregistrer un commentaire