>  Docs Center  >  Libraries  >  Buie  >  LCLXTREM
Libraries

LCLXTREM

LCLXTREM

Name


  lclxtrem

Purpose


  Find local minima or maxima in a 1-d vector.

Description


  Scan a vector and identify all maxima or minima separated by more than
    WIDTH values.

Category


  Spectroscopy

Calling Sequence


  idx=lclxtrem(vec,width,[/MAXIMA])

Inputs


  vec - Input vector of data points.

Optional Input Parameters


  width - size of zone to search, minima (or maxima) separated by less than
            width are never returned. (Default = 5)

Keyword Input Parameters


  MAXIMA - Flag, if set, causes program to search for local maxima, the default
            is to search for local minima

Outputs


  Returns indicies into vec that give local extrema. This returned vector
    is also sorted by decreasing absolute value of vec.

Keyword Output Parameters


  COUNT - Number of extrema returned. If 0, there was an error.

Common Blocks


Side Effects


Restrictions


  The first and last points in the array will NEVER be flagged as extrema
    since there is no information to decide if the endpoint is an inflection
    or not. There is one exception to this condition. If the data are
    smooth and there are no inflection points, one or the other of the
    endpoints will be the absolute extreme. In this case only, will an
    endpoint be returned.

Procedure


  This procedure scans the vector and looks for local maxima or local minima.
  In the first pass, all such extrema are flagged, if you want all of them
  Just set width to 0 if you want _all_ local extrema. The second pass
  filters our extrema that are too close together. The width of the filter
  can be provided, the default is 5. The extrema are scanned in decreasing
  absolute value. For each extremum, all other extrema that are fainter and
  are closer than width away are removed from the list. The returned vector
  of indicies is sorted by decreasing size of the peak/trough.

Modification History


  97/12/5, Written by Marc W. Buie, Lowell Observatory
  99/11/24, MWB, total rewrite to speed it up and make it work properly.



© 2024 NV5 Geospatial Solutions, Inc. |  Legal
   Contact Us