Create a logarithmic Latin Hypercube Sampling distribution (with lhsdesign).
27 次查看(过去 30 天)
显示 更早的评论
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 :)
0 个评论
采纳的回答
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 Center 和 File Exchange 中查找有关 Probability Distributions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!