필터 지우기
필터 지우기

Create a logarithmic Latin Hypercube Sampling distribution (with lhsdesign).

조회 수: 27 (최근 30일)
Lorenz
Lorenz 2023년 6월 27일
댓글: Lorenz 2023년 6월 28일
Hi,
i want to get a logarithmic sample distribution with lhsdesign and fix boundaries. Heres my code:
num_samples = 40; % number of samples
num_parameters = 2; % number of parameters
variableBounds = [1e-14 1e-12; 1e-14 1e-12]; % defines the boundaries
lhsMatrix = lhsdesign(num_samples, num_parameters);
% Scale the LHS samples to the desired parameter ranges
params = zeros(num_samples, num_parameters);
for j = 1:num_parameters
params(:, j) = lhsMatrix(:, j) * (variableBounds(j, 2) - variableBounds(j, 1)) + variableBounds(j, 1);
end
scatter(params(:,1), params(:,2),'filled', 'MarkerFaceAlpha',0.3, 'SizeData',90,'MarkerFaceColor', 'blue');
xlabel('$Parameter 1$', 'Interpreter', 'latex');
ylabel('$Parameter 2$', 'Interpreter', 'latex');
title('Sample distribution');
% set(gca, 'XScale', 'log');
% set(gca, 'YScale', 'log');
grid on
If i create the lhsMatrix with lhsdesign, the samples will get distributed perfectly with no log axes.
What i desire is a proper sample distribution with log axes.
num_samples = 40; % number of samples
num_parameters = 2; % number of parameters
variableBounds = [1e-14 1e-12; 1e-14 1e-12]; % defines the boundaries
lhsMatrix = lhsdesign(num_samples, num_parameters);
% Scale the LHS samples to the desired parameter ranges
params = zeros(num_samples, num_parameters);
for j = 1:num_parameters
params(:, j) = lhsMatrix(:, j) * (variableBounds(j, 2) - variableBounds(j, 1)) + variableBounds(j, 1);
end
scatter(params(:,1), params(:,2),'filled', 'MarkerFaceAlpha',0.3, 'SizeData',90,'MarkerFaceColor', 'blue');
xlabel('$Parameter 1$', 'Interpreter', 'latex');
ylabel('$Parameter 2$', 'Interpreter', 'latex');
title('Sample distribution');
set(gca, 'XScale', 'log');
set(gca, 'YScale', 'log');
grid on
As you can see the distribution with log axes is really bad. So i need to create a lhsMatrix with log values to get a proper distribution on my log scales. Can someone help me out with this problem?
Thanks in advance :)

채택된 답변

Harald
Harald 2023년 6월 28일
Hi Lorenz,
I am not sure whether this is legitimate from the statistics point of view, but you could get a nice distribution by taking the log of the bounds and then the exponential of params. For better readability, you could use base 10 for both.
variableBounds = log10([1e-14 1e-12; 1e-14 1e-12]); % or log
%...
params = 10.^(params); % or exp
Best wishes,
Harald

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Probability Distributions에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by