Equation Editor


Equation Editor allows you to enter an algebraic equation that can mathematically manipulate measured data. The results are displayed as a data trace. Data that is used in the equation can be from the same or different channels.

Note: Equation Editor is now available with ALL PNA Apps.

See Also

Using Noise Power Traces in Equation Editor

Equation Editor and MATLAB

Equation Editor Import Functions

External DC Meter Data Conversion

Other 'Analyze Data' topics

Overview

Equation Editor allows you to enter an algebraic equation of standard mathematical operators and functions, referencing data that is available in the analyzer.  Once a valid equation is entered and enabled, the display of the active trace is replaced with the results of the equation, and updated in real-time as new data is acquired.  For equations that can be expressed with Equation Editor's supported functions, operators, and data, there is no need for off-line processing in a separate program.

For example, enter the equation S21 / (1 - S11). The resulting trace is computed as each S21 data point divided by one minus the corresponding S11 data point.  For a 201 point sweep setup, the computation is repeated 201 times, once for each point.

As another example, suppose you want the analyzer to make a directivity measurement of your 3-port DUT.  This is not a native measurement, but can be achieved using the Equation Editor.  The desired result is the sum and difference of LogMag formatted traces, expressed as: S12 + S23 - S13.  

Because Equation Editor operates on unformatted complex data, the required equation is:

DIR = S12 * S23 / S13

DIR becomes a display label to help you identify the computed data trace.

On the equation trace, set the format to LogMag.

How to start Equation Editor

Using front-panel
hardkey
[softkey] buttons

Using Menus

  1. Press Analysis

  2. then [Equation Editor]

  1. Click Marker/Analysis

  2. then Analysis

  3. then Equation Editor

 

Equation Editor dialog box help

Notes

  • Double-click, or type, the Functions, Operators, and Data to build an Equation.

  • Scroll down to learn more about Using Equation Editor

Equation: The field in which equations are built. Click the down arrow to the right to use or modify equations that have been previously saved.  This is where equations are saved when you press 'Store Equation'.

Enabled  Check this box to enable the equation that is currently in the Equation field. If the Enabled box is not available, then the equation is not valid. If a data trace is used that is from a different channel than the Equation trace, the channels MUST have the same number of data points to be valid.

<-Backspace  Moves the cursor to the left while erasing characters.

<-  Moves the cursor to the left without erasing characters.

->  Moves the cursor to the right without erasing characters.

Store Equation  Press to save the current equation. To later recall the equation, click the down arrow to the right of the equation.

Delete Equation  Removes the current equation from the drop-down list.

Functions/Constants:  See descriptions of Functions.

Select the "library" of functions to view.  The "built-in" library appears by default which includes the standard functions of equation editor. Other functions that can appear here are functions that you have written and imported.  Learn more.

Operators:  See descriptions of Operators.

Trace Data: Select from ALL of the currently displayed traces on ALL channels.

Ch Param Data: Select from undisplayed data that is available ONLY from the active channel (same channel as the equation trace).  See Data that is used in Equations.

Note: With an external test set enabled, only parameters involving ports 1 through 4 are listed. However, all available parameters can be typed directly into the Equation field.  

Keypad: Provided to allow navigation of the entire dialog with a mouse.

Import Functions  Click to launch the Import Functions Dialog box.

Use Short Names  Some functions have shortened names that are entered automatically when checked. Both long and short names can be used interchangeably.

Enable Matlab  Available when a full MATLAB version is installed by you on the analyzer. Learn more.

Using Equation Editor

1. Pick a trace in which to enter the equation

2. Enter an equation

Start Equation Editor See how.

3. Check for a valid equation

When a valid equation is entered, the Enabled checkbox becomes available for checking. When the Enabled box is checked:

Learn more about the Functions, Operators, and Data that are used in Equation Editor.

Data that is used in Equation Editor

Definitions

Example: eq=Tr2+S11 is entered into Tr1.

Tr1 becomes an equation trace.

Tr2 and S11 are both referred traces because they are used in the equation trace.

Notes

There are three ways to refer to traces:

The following distinction is important when discussing the three ways to refer to traces/data.

1. Using TrX  Trace notation (for example, Tr2).

When a trace is created, check "Show Tr Annotation" to see the Tr number of that trace.

2. Using S-parameter notation (for example, S11/S21)

3. Using Receiver notation (for example AB_2); NOT case sensitive.

At least one receiver is required, followed by an underscore and a number.

Examples

Learn more about ratioed and unratioed receiver measurements.

Receiver notation is like S-parameter notation in that:

Referring to Traces in a different channel

When the equation trace refers to a trace on a different channel:

Port Extensions and Equation Editor

When using port extension with an equation, turn Fixturing ON to ensure that the underlying parameters have port extension properly applied. Learn more.

Trace Settings, Error Correction, and an Example

This discussion highlights the differences between using S-parameter / Receiver notation and TrX notation when referring to traces. The key to understanding the differences is realizing that S-parameter / Receiver notation ALWAYS refers to data that is NOT displayed.

See Equation Editor Notes at GetData Method or GetDataByString Method.

Error-correction and Equation Editor

Using TrX notation:

Using S-parameter and Receiver notation:

Example

This example illustrates the differences when referring to a trace using S-parameter notation and TrX notation:

Functions and Constants used in Equation Editor

ALL trace data that is used in Equation Editor is unformatted, complex data.

When using a mouse with the analyzer, hover over a function in the dialog to learn how it is used.

In the following table,

  • Function(scalar x) means that an automatic conversion from a complex number to its scalar magnitude is performed before passing the value to the function.

  • Function(complex x) means that the entire complex value is used.

  • a, b, c, d are arguments that are used in the function.

 

Function/Constant

Description

acos(scalar a)

returns the arc cosine of a in radians

asin(scalar a)

returns the arc sine of a in radians

atan(scalar a)

returns the arc tangent of a in radians

atan2

returns the phase of complex a = (re,im) in radians

has the following  two argument sets:

  • atan2(complex a) - returns the phase in radians

  • atan2(scalar a, scalar b)

conj(complex a)

takes a and returns the complex conjugate

cos(complex a)

takes a in radians and returns the cosine

cpx(scalar a, scalar b)

returns a complex value (a+ib) from two scalar values

e

returns the constant =~ 2.71828...

exp(complex a)

returns the exponential of a

getNumPoints()

returns the number of points for the current sweep

im(complex a)

returns the imag part of a as the scalar part of the result (zeroes the imag part)

kfac(complex a, complex b, complex c, complex d )

when entered in EE:
kfac(S11,S21,S12,S22)

k-factor:

k = (1 - |a|^2 - |d|^2 + |a*d-b*c|^2 ) / (2 * |b*c|)

returns a scalar result - the imaginary part of the complex result is always 0

ln(complex a)

returns the natural logarithm of a

log10(complex a)

returns the base 10 logarithm of a

mag(complex a)

returns sqrt(a.re*a.re+a.im*a.im)

max(complex a, complex b, ...)

returns the complex value that has the largest magnitude of a list of values.

max_hold(complex a)

holds the current maximums of the sweep. Disable the equation to reset. See example

median(complex a, complex b,...)

returns the median of a list of complex values

  • The median is determined by sorting the values by magnitude, and returning the middle one.

  • If an even number of values is passed, then the smaller of the two middle values is returned.

min(complex a, complex b, ...)

returns the complex value that has the smallest magnitude of a list of values.

min_hold(complex a)

holds the current minimums of the sweep. Disable the equation to reset. See example

mrkx(a,b)

returns the x-axis value of marker number b on trace number a.

mrky(a,b)

returns the y-axis value of marker number b on trace number a.

mu1(complex a, complex b, complex c, complex d )

when entered in EE:
mu1(S11,S21,S12,S22)

mu1 = (1 - |a|^2) / ( |d - conj(a) * (a*d-b*c)| + |b*c| )

mu2( complex a, complex b, complex c, complex d )

when entered in EE:
mu1(S11,S21,S12,S22)

mu2 = (1 - |d|^2) / ( |a - conj(d) * (a*d-b*c)| + |b*c| )

for both mu1 and mu2 (Usually written with the Greek character μ )

  • conj is the complex conjugate. For scalars a and b,   conj(a+ib) = (a-ib)

  • returns a scalar result - the imaginary part of the complex result is always 0

phase(complex a)

returns atan2(a) in degrees

PI

returns the numeric constant pi (3.141592), which is the ratio of the circumference of a circle to its diameter

pow(complex a,complex b)

returns a to the power b

re(complex a)

returns the scalar part of a (zeroes the imag part)

sin(complex a)

takes a in radians and returns the sine

sqrt(complex a)

returns the square root of a, with phase angle in the half-open interval (-pi/2, pi/2]

tan(complex a)

takes a in radians and returns the tangent

traceDataArray(complex a)

returns the entire set of points from a sweep. Function is intended to be used as an argument in an custom function to allow access for data array processing.

xAxisArray() or xAxisArray(integer a)

returns the current value of the x-axis for this channel or from a specified channel.

xAxisIndex()

returns the current index in the sweep.

xAxisValue() or xAxisValue(integer a)

returns the current value of the x-axis index for this channel or from a specified channel.

Operators used in Equation Editor

Operator

Description

+

Addition

-

Subtraction

*

Multiplication

/

Division

(

Open parenthesis

)

Close parenthesis

,

Comma - separator for arguments (as in S11, S22)

=

Equal (optional)

E

Exponent (as in 23.45E6)

Example Equations

The following examples may help you get started with Equation Editor.

Offset each data point in Tr2 from Tr1 by 2dB

Use the function: pow(complex a, complex b)  -- returns a to the power b.

20log(a) + 2 = 20log(x)
log( a ) + 2/20 = log( x ) // divide all by 20.
x = 10^(log(a) + 2/20)   // swap sides and take 10 to the power of both sides
x = 10^log(a) * 10^(2/20)
x = a * 10^(2/20)

The equation is entered into Tr2 as:

Offset=Tr1*pow(10, 2/20)

To offset by 5 dB

Offset=Tr1*pow(10, 5/20).

Balanced Match using a 2-port analyzer

SDD11 = (S11-S21-S12+S22)/2

Conversion loss

B_1/pow(10,-15/20)

Third-order intercept point (IP3 or TOI)

TR1*sqrt(Tr1/Tr3)

Harmonics in dBc

B_1/Tr2

PAE (Power Added Efficiency)

Pout - Pin / Pdc

Type the following equation into a new trace with an unratioed measurement, such as AI1. The data format is REAL:

PAE = 100 * (.001*pow(mag(Tr1),2)-(.001*pow(mag(Tr1),2)/pow(mag(Tr2),2)))/(Tr3*Tr4)

Where:

Data is displayed in Real format with units actually being watts.

1-port Insertion Loss

When it is not possible to connect both ends of a cable to the analyzer, a 1-port insertion loss measurement can be made. However, the measured loss must be divided by 2 because the result includes the loss going down and coming back through the cable. This assumes that the device is terminated with a short or open to reflect all of the power. The 'divide by 2' operation (for dB) is performed as follows using Equation Editor:

Max and Min Hold

These two functions allow you to capture and display either the Maximum or Minimum values for each data point over multiple sweeps.

Maxhold(S21) - displays the maximum value for each data point until reset. Reset by disabling, then enabling the equation.  This example refers to an S21 trace that is not displayed.

Saving Equation Editor Data

Equation data can be saved to the analyzer hard drive in the following formats:

Equation data can NOT be saved in .SnP file format. When attempting to save an Equation trace in .SnP format, the "underlying" S-parameter data is saved; not Equation data.