MATLAB has a few functions for building one dimensional grids (linspace
, logspace, grid, ets). I need a function for generating an irregular one-dimensional grid with certain points distribution density.
Let's say: nonelinspace(a, b, N, @distr)
, where a
, b
is the interval, N
- the number of points and distr
is a function of points density (polynomial, Gaussian, hyperbolic, ...).
Is this possible to do in MATLAB?
Additional remarks:
we have an interval [a, b] divided by N = 1000 points: linspace(a, b, N);
set number of cells (n = 100) and some density distribution function: distr = @(o) exp(-1e-3*((0:o) - .5*o).^2)
like this.
The expression N*distr(n)/sum(distr(n))
(or round(N*distr(n)/sum(distr(n)))
) gives us number of points in every cell. And we need distribute the points EVENTLY along whole interval [a, b].
a
andb
are always included values or just limits for that distribution ? – bla