Logical scalar values - operators, MATLAB in Engineering

Logical scalar values:

The MATLAB also has or and and operators which work element wise for the matrices:

1084_Logical scalar values.png

These operators will compare any of the two vectors or matrices, as long as they are of similar size, element-by-element, and return a vector or matrix of similar size of logical 1's and 0's. The operators |  | and && are only used with scalars, not matrices. For illustration,

>> v1 = [3 0 5 1];

>> v2 = [0 0 2 0];

>> v1 & v2

ans =

0  0  1  0

>> v1 | v2

ans =

1  0  1  1

>> v1 && v2

??? Operands to the || and && operators should be convertible to the logical scalar values.

1713_Logical scalar values1.png

As with numerical operators, it is significant to know that the operator precedence rules. Table shows the rules for the operators which have been covered faraway, in the order of the precedence.

 

Posted Date: 10/19/2012 6:00:14 AM | Location : United States







Related Discussions:- Logical scalar values - operators, Assignment Help, Ask Question on Logical scalar values - operators, Get Answer, Expert's Help, Logical scalar values - operators Discussions

Write discussion on Logical scalar values - operators
Your posts are moderated
Related Questions
Basic mathematical operations: All the basic mathematical operations can be executed on symbolic expressions and variables (example, add, raise to a power, multiply, subtract,

Graphics Properties: The MATLAB uses the Handle Graphics in all its figures. All figures consist of various objects, each of which is assigned a handle. The object handle is a

Calling of Function polyval: The curve does not appear very smooth on this plot, but that is as there are only five points in the x vector. To estimate the temperature

Function strncmp: The function strncmp compares only the first n characters in the strings and ignores the rest. The initial two arguments are strings to compare, and third ar

Solving 2 × 2 systems of equations: However this may be easy in a MATLAB, in normal finding solutions to the systems of equations is not. The systems which are 2 × 2 are, thou

Gauss Elimination: The Gauss elimination technique consists of:    Generating the augmented matrix [A b]    Applying EROs to augmented matrix to obtain an upper trian

Algorithm for the function explaine: The algorithm for the function explaine is as shown:  Print a description of e, the exp function, and how to find the approximate va

Gauss, Gauss-Jordan elimination: For 2 × 2 systems of equations, there are well-defined, easy solution techniques. Though, for the larger systems of equations, finding solutio

Preallocating a Vector: There are necessarily two programming techniques that can be used to simulate the cumsum function. One technique is to begin with an empty vector and c

Tracing of Square matrices: The trace of a square matrix is the addition of all the elements on the diagonal. For illustration, for the preceding matrix it is 1 + 6 + 11 + 16,