Program: MKLSGRIDNEWVERTICAL
mklsgridnewvertical......construct improved depth/radius sampling
call: [newz,newdr]=mklsgridnewvertical(lsopt,z,f);
lsopt: (structure)
LSOPT structure as returned by MKLSOPT
z: (numeric array) [km]
current depth/radius sampling. This vector contains the
current depths/radii of the grid layers.
In case of cartesian grids, this is a depth below the
surface. In case of spherical grids, this is a radius
(which will be converted into a depth internally)
f: (numeric array) [km]
maximum compatibility reached at the given depths/radii
(the function value to be optimized)
result: newz: (numeric array) [km]
new list of depth/radius values the hopefully will bracket
th maxima of cofz(z) better than the previous ones.
This list is unique and does not contain values that are
also contained in Z.
If Z contains only one value, NEWZ will be empty.
newdr: (number) [km]
new depth/radius sampling interval. This must be compared
to lsopt.iter_drmin to stop the iteration.
If Z contains only one value, NEWDR will be NaN.
This routine essentially performs a multimodal maximization of a 1D
function f(z). It is applied to the layer sequences of both cartesian and
triangular grids. The routine does not evaluate the target function, but
constructs a new sampling of the input variable that will hopefully give
a better solution for the function value, which has to be computed
outside.
The optimization result, however, depends on the input. A finer initial
sampling results in a better chance to get all maxima (in case of multimode functions).
The search _can_ do multimodal optimization, but unfortunately I can not
guarantee that all maxima are found. (you will hardly find a method that
can give such a guarantee!)
The search does not leave the interval min(z)...max(z). So if a maximum
is identified that contains the interval margin or is very close to it,
it is _your_ responsibility to re-run the search with a wider initial
interval.
Note: this routine is implemented for the special case of a positive
stair-like function and performs poor for other functions.
(the target function for this problem is integer-valued and positive)
Martin Knapmeyer, 28.06.2005, 04.07.2005, 01.09.2005
completely rewritten 06.09.2005
completely rewritten 29.09.2005
Read M-File Source Code
eof.