2.8.19 mathtool


Menu Information

Analysis: Mathematics: Simple Curve Math

Brief Information

Perform simple arithmetic on a curve or XY data range.

Command Line Usage

  1. mathtool iy1:=(Col(1), Col(2)) iy2:=(Col(3), Col(4)) operator:=sub;
  2. mathtool iy1:=Col(2) operator:=add operand:=const const:=10;
  3. mathtool iy1:=Col(2) operator:=custom iy2:=Col(3) formula:=y1*100+y2^2 oy:=(<new>,<new>);

Variables

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

Input

XYRange

<active>

Input XY data range or curve

Operator operator

Input

int

add

Operator
Option list

  • add:Add
    Addition
  • sub:Subtract
    Subtraction
  • Div:Divide
    Division
  • mul:Multiply
    Multiplication
  • pow:Power
    Power
  • custom:Custom
    Customize with formula
Operand operand

Input

int

data

The operand type.
Option list

  • Const:Const
    Use constant as operand
  • Data:Reference Data
    Use reference curve as operand
Reference Data iy2

Input

XYRange

<optional>

Specifies a curve (XY Range) as operand. This option is available when you select Reference Data from the Operand drop-down. When the two datasets' coordinates differ, the two curves will be interpolated or extrapolated with linear interpolation before the specified operation is performed.

Constant const

Input

double

10

Specifies a constant as operand. This option is available when select Const from Operand drop-down.

Formula formula

Input

string

<unassigned>

Specifies the formula to calculate, in which y1 means Input1 and y2 means Reference data. This option is available when Custom is selected from Operator drop-down list.

Use Common Range Only common

Input

int

0

Operate on the common range between the two curves. This checkbox is available when select Reference Data from Operand drop-down.

Rescale Source Graph rescale

Input

int

1

Specify whether to rescale the source graph after arithmetic operation.

Output oy

Output

XYRange

Specifies the output data range. In script, the default option is <input>, while in GUI, defult is <new>. See the syntax here.

X Minimum xmin

Output

double

<unassigned>

Minimum X value of output curve

X Maximum xmax

Output

double

<unassigned>

Maximum X value of output curve

X Mean xmean

Output

double

<unassigned>

Mean X value of output curve

Y Minimum ymin

Output

double

<unassigned>

Minimum Y value of output curve

Y Maximum ymax

Output

double

<unassigned>

Maximum Y value of output curve

Y Mean ymean

Output

double

<unassigned>

Mean Y value of output curve


Examples

  1. Import Gaussian.dat from <Origin Program Directory>\Samples\Curve Fitting folder.
  2. Highlight column B and select Plot > Basic 2D : Line to plot a curve.
  3. Type the following script in the script window to open mathtool dialog:
    mathtool -d;
    Or with Gaussian.dat worksheet active, click Analysis: Mathematics: Simple Curve Math to open mathtool dialog.
  4. Select Subtract from Operator drop-down list, and make sure Reference Data selected in Operand. Click the interactive data selection button Mathtool help English files image002.jpg to the right of Reference Data branch, and select column C in the source worksheet as Operand. And then click OK button.

The original curve will be subtracted. The result should show as follows:

Mathtool example.png

More Information

Please refer to this page in the User Guide for more information.

Related X-Functions

vmathtool