This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Locate sites with respect to mesh sites


pointer = sorted(meshsites,sites)


Various commands in this toolbox need to determine the index j for which a given x lies in the interval [ + 1], with (ti) a given nondecreasing sequence, e.g., a knot sequence. This job is done by sorted in the following fashion.

pointer = sorted(meshsites,sites) is the integer row vector whose j-th entry equals the number of entries in meshsites that are ≤ ssites(j), with ssites the vector sort(sites). Thus, if both meshsites and sites are nondecreasing, then

meshsites(pointer(j)) ≤ sites(j) < meshsites(pointer(j)+1)

with the obvious interpretations when

pointer(j) < 1    or    length(meshsites) < pointer(j) + 1 

Specifically, having pointer(j) < 1 then corresponds to having sites(j) strictly to the left of meshsites(1), while having length(meshsites) < pointer(j)+1 then corresponds to having sites(j) at, or to the right of, meshsites(end).


The statement

sorted([1 1 1 2 2 3 3 3],[0:4])

will generate the output 0 3 5 8 8, as will the statement

sorted([3 2 1 1 3 2 3 1],[2 3 0 4 1])


The indexing output from sort([meshsites(:).',sites(:).']) is used.