Spline Toolbox
  Go to function:
    Search    Help Desk 
sorted    Examples

Locate points with respect to meshpoints

Syntax

Description

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

The vector index=sorted(meshpoints,points) is the integer sequence for which, for all j, index(j) equals the number of entries in meshpoints that are spoints(j), with spoints=sort(points). Thus, if both meshpoints and points are nondecreasing, then

with obvious interpretations when

Examples

The statement

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

Algorithm

The indexing output from sort([meshpoints(:).',points(:).']) is used.



[ Previous | Help Desk | Next ]