# Creating a formula

With the Formula operator you can create a mathematical or logical expression to operate on data values in an echogram or echograms (the operands). You use the Formula editor window to define the formula.

It is useful to familiarize yourself with the tools on the Formula editor window before continuing with this topic:

## Begin an expression

Initially the Formula editor window will contain "f(p, s) =" with a single placeholder.

To begin an expression:

1. Click the desired formula element in the Elements toolbar
2. Click the placeholder

To add elements to the expression:

1. Click the desired formula element in the Elements toolbar
2. Click a placeholder to insert the chosen element at the placeholder

- OR -

Display an insertion marker (point to a formula element) then click to insert the chosen element at the indicated point.
3. Configure any properties or child elements/properties of the main element.

Note: Descriptions of elements are found in the discussion for the Elements toolbar.

## Remove elements

To remove elements from an expression:

1. Point to the element you wish to remove.
2. Right-click to display the Shortcut menu.
3. Ensure that the element you wish to delete is selected.
4. On the Shortcut menu, click Delete.

Notes:

• You can select Undo and Redo on the Edit menu.
• Remove on the Manipulate menu can remove the main (selected) element and leave partially complete child elements.

## Manipulate Elements

You can manipulate the order of elements and swap elements around within your formula.

To manipulate a formula:

1. Select the element you wish to change.
3. Select a Manipulate menu item.

Notes:

## Evaluate an expression

The Formula editor Evaluate button can be used to analyze how your expression will be evaluated.

1. Use the Input panel to specify a ping number (p) and a sample number (s) for test evaluation.
2. Use the Structure panel to determine details about an evaluation for selected elements of the expression. Press Evaluate.

## Examples

Mathematical expression - a 3x3 convolution.

Example of a multiple variable expression using logical operators - a multi-frequency classification rule.