Dataplot Vol 2 Vol 1

# MATRIX TRUNCATION

Name:
MATRIX TRUNCATION (LET)
Type:
Let Subcommand
Purpose:
Set all elements in a matrix less than (or greater than) a specified value to that value.
Description:
The primary motivation for this command is to subtract a background value from a matrix. This can be accomplished by using the MATRIX SUBTRACT command to subtract the background value and then using the MATRIX TRUNCATION command to set all negative values to zero.
Syntax 1:
LET <Z> = MATRIX TRUNCATION <M> <VALUE>
where <M> is a matrix;
<VALUE> is a parameter or a number that specifies the truncation value;
and     <Z> is the matrix that is returned after the truncation is applied.

This syntax is used to perform lower truncation (that is, any values less than <VALUE> are set equal to <VALUE>. The <Z> matrix can be the same as the <M> matrix.

Syntax 2:
LET <Z> = MATRIX UPPER TRUNCATION <M> <VALUE>
where <M> is a matrix;
<VALUE> is a parameter or a number that specifies the truncation value;
and     <Z> is the matrix that is returned after the truncation is applied.

This syntax is used to perform upper truncation (that is, any values greater than <VALUE> are set equal to <VALUE>. The <Z> matrix can be the same as the <M> matrix.

Examples:
LET VALUE = 8
LET M = MATRIX TRUNCATION M VALUE
Default:
None
Synonyms:
MATRIX LOWER TRUNCATION is a synonym for MATRIX TRUNCATION
Related Commands:
 MATRIX SUBTRACTION = Perform matrix subtraction. MATRIX ADDITION = Perform matrix addition. MATRIX MULTIPLICATION = Perform matrix multiplication.
Applications:
Matrix Arithmetic
Implementation Date:
2006/3
Program:
```
1  2  3
4  5  6
7  8  9
10 11 12
END OF DATA
.
LET ZERO = 0
LET AVAL = 4
LET M = MATRIX SUBTRACTION M AVAL
LET M = MATRIX TRUNCATION M ZERO
.
SET WRITE DECIMALS 0
PRINT M
```
The resulting M matrix is:
```
MATRIX M       --            4 ROWS
--            3 COLUMNS

VARIABLES--M1             M2             M3

0              0              0
0              1              2
3              4              5
6              7              8
```

Date created: 4/14/2006
Last updated: 4/14/2006