Uniformly-Distributed Points

버전 1.0.1 (2.41 KB) 작성자: Moreno, M.
Generate uniformly-sampled points in a 1D, 2D or 3D cartesian or spherical domain with optional pre-existing data via MAXIMIN design
다운로드 수: 145
업데이트 날짜: 2022/4/22

라이선스 보기

Calling X = maximin(N, P, varargin) Generates N-uniformly distributed points in P dimensions using the following optional parameter-value pairs:
- 'iterations' Specifies the number of iterations, per cycle.
- 'cycles' Specifies the number of algorithm repetitions.
- 'criterion' Specifies 'cartesian' or 'spherical' sampling.
- 'data' Specifies existing data points in [M, P] form.
- 'initial' Specifies a set of [N, P] points to reiterate.
Examples of the use of this function are the following:
% Generate 40 cartesian equally-spaced points in 3D
x = maximin(40, 3);
plot3(x(:, 1), x(:, 2), x(:, 3), 'o')
view(3)
% Generate 20 equally-spaced points in 2D with pre-existing data
y = rand(10, 2);
x = maximin(20, 2, 'data', y);
figure
hold on
plot(x(:, 1), x(:, 2), 'x')
plot(y(:, 1), y(:, 2), 'o')
% Generate 12 spherical optimally-sampled points in 3D (icosahedron) and create edges
p = maximin(12, 3, 'criterion', 'spherical', 'cycles', 20);
figure
hold on
plot3(p(:, 1), p(:, 2), p(:, 3), 'o', 'Color', 'k')
for i = 1 : 12
d = sum((p(i, :) - p) .^ 2, 2);
d(d == 0) = Inf;
[~, j] = mink(d, 5);
for k = 1 : size(j, 1)
x = [p(i, 1), p(j(k), 1)];
y = [p(i, 2), p(j(k), 2)];
z = [p(i, 3), p(j(k), 3)];
plot3(x, y, z, 'Color', 'k')
end
end
pbaspect([1, 1, 1])
view(3)
% Circular packing problem
p = maximin(10, 2, 'cycles', 20);
d = zeros(10, 1);
for i = 1 : 10
j = sum((p(i, :) - p) .^ 2, 2);
d(i) = min(j(j > 0));
end
d = 0.5 * sqrt(min(d));
a = 2 * pi * (0 : 1 / (1000 - 1) : 1)';
c = d * [cos(a) sin(a)];
figure
hold on
plot(p(:, 1), p(:, 2), 'x', 'Color', 'k')
for i = 1 : 10
plot(c(:, 1) + p(i, 1), c(:, 2) + p(i, 2), 'Color', 'k')
end
xlim([min(p(:, 1) - d), max(p(:, 1) + d)])
ylim([min(p(:, 2) - d), max(p(:, 2) + d)])
pbaspect([1 1 1])

인용 양식

Moreno, M. (2024). Uniformly-Distributed Points (https://www.mathworks.com/matlabcentral/fileexchange/108374-uniformly-distributed-points), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2022a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.1

Slight code efficiency enhancements and uniform spherical permutations. Faster number of combinations.

1.0.0