Matrix calculator

Print Previous page Top page Next page

Matrix calculator is intended for carrying out operations of map algebra over matrices of qualities and heights. Map algebra (local operations) - operations, during which, based on one or several initial matrices, a new matrix is created, and the values of the cells of this matrix depend only on the values of the cells of the initial matrices that have the same coordinates.

 

 

Matrix_calculator_engl

 

Matrix calculator. 1 - Toolbar. 2 - «Output file». 3 - «Legend». 4 - «Calculation area».

5 - «Matrices». 6 - «Operators». 7 - «Expression»

 

The toolbar contains 3 buttons:

button_1 Exit;

button_2 Help;

button_3 Start calculation.

 

The panel «Output file» is intended for a choice of a path of saving a created matrix of quality.

 

On the «Legend» panel, you can set the number of colors in the palette of the created matrix, which can vary from 1 to 32. Also, using the «Edit gradations» check-box, you can enable manual editing, in which each color can be set manually. If the «Edit gradations» check-box is not checked, then the user sets only the extreme colors, and all intermediate ones are calculated automatically.

 

On the panel «Calculation area» it is possible to choose area of construction in four ways:

-        «The whole area» - the matrix will be constructed within the rectangular area covering all open matrixes of qualities and heights, projection of which coincides with the projection of the document;

-        «Rectangular area» - the matrix will be constructed within the chosen rectangular area;

-        «Object outline» - the matrix will be constructed within the rectangular area covering chosen object;

-        «Area by coordinates» - the matrix will be constructed within the rectangular area specified by the coordinates of two corners.

 

The panel «Matrices» contains a list of all open matrices of qualities and heights, projection of which coincides with the projection of the document. Double-clicking on the name of the matrix will add it pnto the expression input field.

 

Panel «Operators» is intended for a convenient insert of operators into expression.

The following mathematical operations are supported:

button_+ addition;

button_- subtraction;

button_umn multiplication;

button_del division;

button_stepen exponentiation;

button_log logarithm;

button_logN natural logarithm;

button_sin sine of the angle in radians;

button_cos cosine of an angle in radians;

button_tg tangent of an angle in radians;

button_ctg the cotangent of the angle in radians;

button_asin arcsine in radians;

button_acos arccosine in radians;

button_atg arctangent in radians;

button_actg arc cotangent in radians;

button_exp exponent;

button_mod module;

button_round rounding;

button_ost remainder of the division.

 

The use of brackets button_scob1 and button_scob2 is allowed.

The conditional operator button_con  allows you to assign values to the cells of the generated matrix based on a specified condition. This operator consists of three parts:

-        condition;

-        the value that will be assigned to the matrix cell when the condition is met;

-        the value that will be assigned if the condition is not met.

 

Checking cells on lack of data – button_isnull. When using this operator, the cells of the created matrix will be assigned the value 1 if the corresponding cells of the original matrix have the value NULL, that is, they have no data, and 0 otherwise.

 

Setting the value of cells NULL – button_setnull. This operator can only be used as an assigned value in a conditional operator. When using this operator, the corresponding cells of the created matrix will be assigned a NULL value, that is, they will not contain data and will be displayed on the map.

Comparison operations:

button_ravno equal;

button_neravno not equal;

button_more more;

button_more_ravno more or equal;

button_smol less;

button_smol_ravno less or equal.

 

If you use comparison operators outside the conditional operator, then all cells in the generated matrix, except for those that are NULL, will be assigned the value 1 if the specified condition is met, and 0 otherwise.

Logic operations:

button_and AND;

button_or OR;

button_not NOT.

 

The «Expression» panel contains a field for entering mathematical and logical expressions. This field is intended for entering expressions using quick input buttons, the list of available matrices and the keyboard.

If, when performing any operation, it turns out that a cell of one of the original matrices has a NULL value, that is, does not contain data, then the corresponding cell of the created matrix will also be assigned a NULL value. An exception is the isNull operator, as a result of which all cells of the created matrix will be assigned the value 1 or 0.

If the expression contains several matrices with different cell sizes, then the size of the cells of the created matrix will be equal to the size of the cells of the first matrix in the expression. To calculate the value of each cell of the created matrix, the values ​​of the cells nearest to it of the original matrices will be taken.

 

Examples.

1. To build a matrix, which elements would be equal to the sum of the elements of the matrices FirstMatrix.mtq and SecondMatrix.mtq, you need to enter the following expression:

"1.FirstMatrix.mtq" + "2.SecondMatrix.mtq"

 

2. To build a matrix which elements would be equal to the elements of the matrix FirstMatrix.mtq rounded to the nearest side, you need to enter the following expression:

rnd("1.FirstMatrix.mtq")

 

3. If there is a matrix Height.mtq, in the elements of which the height value is stored, then you can find out the areas in which the height is greater than 0 by entering the following expression:

"1.Height.mtq" > 0

The areas of the resulting matrix, in which the condition is satisfied, will have the value 1, and in which it is not - 0.

 

4. To display only areas where the height value stored in the elements of the Height.mtq matrix is ​​less than 0, enter the following expression:

Con("1.Height.mtq" < 0; "1.Height.mtq"; setNull)

 

5. To build a matrix, the values ​​of the elements of which would be equal to the values ​​of the elements of the matrix FirstMatrix.mtq, while, so that it was built only on the area where the elements of the matrix SecondMatrix.mtq have the NULL value, you need to enter the following expression:

Con(isNull("2.SecondMatrix.mtq"); "1.FirstMatrix.mtq"; setNull)