OriginLab Corporation - Data Analysis and Graphing Software - 2D graphs, 3D graphs, Contour Plots, Statistical Charts, Data Exploration, Statistics, Curve Fitting, Signal Processing, and Peak Analysis                           
 

2.2.9 levelcrossing


Brief Information

Find X values at a given Y value

Command Line Usage

1. levelcrossing iy:=col(2) level:=2;

2. levelcrossing iy:=col(2) level:=500 direction:=<new> xindex:=<new> type:=left pts:=2;

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Input iy

Input

XYRange

<active>
Specify the input dataset.
Crossing Level level

Input

double

0
Specify the Y value for the level. Then the X-Function will detect the crossings for this level.
ncrossing

Output

int

<new>
Specify the output for the number of the crossing points. This variable is not shown in the dialog box, but you can get the value of this variable by running levelcrossing.ncrossing=; in the Command Window after executing this X-Function.
X Values of Crossing oy

Output

vector

<new>
Specify the output for the X values of the crossing points, and designated as X column.
Directions direction

Output

vector

<new>
Specify the output for the directions of the crossing behaviors, 1 for upward, -1 for downward, and 0 for differentiation is zero, and designated as Y column.
X Indices xindex

Output

vector

<new>
Specify the output for the X indices of the crossing points, designated as Label column.
Y Crossing Values yval

Output

vector

<new>
Specify the output for the Y values, which will all be the same as input level crossing value, designated as Y column.
Nearest Type type

Input

int

0
Specify how to output the X index of the crossing point when the crossing point is interpolated but not the point of the original data.

Option list:

  • any:Any
    The index of the point, which is closest to the crossing point, will be output.
  • left:Left
    The index of the point, which is to the "left" side of the crossing point, will be output.
  • right:Right
    The index of the point, which is to the "right" side of the crossing point, will be output.
Duration Points pts

Input

int

1
This variable is used to control the output of a pair of level crossing points. The distance (indices) of the pair of points should not be less the specified duration, or both crossing points will be discarded. Only integer is acceptable.

Description

This X-Function finds the locations (X values) where the input curve crosses a specified level. For example, if you set the level to be 0, the zero crossing points (where the curve passes 0) will be output. Such zero crossing points could be meaningful for some special curves. Outputs are selectable, including X values, X indices, crossing directions, and Y crossing values. Also, duration can be specified to get rid of some noise.

Note that linear interpolation could be used to get the locations.

Examples

In the following example, we will find the locations where the curve crosses 500.

Levelcrossing 1.png
  1. Use the Import Wizard to import the data <Origin Installation Directory>\Samples\graphing\waterfall.dat into an empty worksheet.
  2. Highlight col(B) and open the levelcrossing dialog by entering levelcrossing -d; in the Command Window.
  3. Enter 500 after Crossing Level. Other settings as following image shows.
    Levelcrossing 2.png
  4. Click the OK button, four new columns will be added to the worksheet, and the X coordinates corresponding to the 500 level, crossing directions, the X indices and Y crossing values will be output there.
    Levelcrossing 3.png
  5. Run levelcrossing.ncrossing=; in the Command Window, the number of intersection points will be shown as:
  LEVELCROSSING.NCROSSING=8

Keywords:crossing, threshold

 

© OriginLab Corporation. All rights reserved.