# Equally-Spaced Points

Version 1.0.4 (3.78 KB) by
Optimal space filling design in an arbitrary number of dimensions. Fixed or preexisting data points can be specified.
Updated 17 Feb 2023

Syntax
osf
osf(x)
osf(n,p)
osf(x,i,j)
osf(n,p,i,j)
osf(settings)
Where:
n Number of samples
p Number of dimensions
i Number of cycles
j Number of iterations
x Initial solution state
settings
settings.num Number of samples (n)
settings.dim Number of dimensions (p)
settings.cyc Number of cycles (i)
settings.itr Number of iterations (j)
settings.ini Initial solution state (x)
settings.fix Fixed data points (f)
settings.lim Limit for dimension range (r)
settings.fig Produce output figure (0 or 1)
Description
Generates n uniformly-sampled points in p dimensions by repeating i cycles of j iterations each. In each iteration, each point's position is altered based on its nearest-neighbour information, seeking to minimise the potential energy between points (assumed to be proportional to the inverse of their squared pointwise distance).
It is advised that the user sets the parameter h to 0 when convenient, and to note that the brute-force nearest neighbour search is slow for larger sample sizes and dimensions. A k-d tree, pre-defined distance matrices or approximate nearest-neighbour search algorithms can be more efficient for those cases.
Examples
% Demo uses of the function (Cases 1-5)
for i = 1:5
osf;
end
% Function with (N, P) and with (N, P, I, J) (Cases 6-7)
osf(40,2);
osf(12,2,10,700);
% Optimise a LHS and an OSF solution (Cases 8-9)
x = osf(lhsdesign(12,2));
osf(x,40,1000);
% Explore a pre-existing design space region (Case 10)
settings.num = 5;
settings.dim = 2;
settings.cyc = 12;
settings.itr = 1000;
settings.ini = [];
settings.fix = x;
settings.lim = [0.5,1; 0.5,1];
settings.fig = 1;
osf(settings);

### Cite As

Moreno, M. (2024). Equally-Spaced Points (https://www.mathworks.com/matlabcentral/fileexchange/124765-equally-spaced-points), MATLAB Central File Exchange. Retrieved .

##### MATLAB Release Compatibility
Created with R2022b
Compatible with any release
##### Platform Compatibility
Windows macOS Linux

### Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.4

Explore pre-existing design space regions via the settings' field 'lim'.

1.0.3

Factorial design cases are treated separately via N-dimensional grid generation

1.0.2

One-dimensional case correction and figure inclusion

1.0.1

Heuristic point cloud initialisation

1.0.0