Lec6 7
Lec6 7
**maxval
This function normally returns the maximum value of an input vector,
but it can also return a second argument containing the location in the
input vector where the maximum value was found. For example, the
statement
**Note
**Note
**The Matrix Inverse
In ordinary algebra, the solution of an equation of the form ax = b is
𝑋 = 𝐴−1 ∗ 𝑏
EX:- Solve the system of equations using the matrix inverse.
**The logical Data Type
The logical data type is a special type of data that can have one of only
two possible values: true or false. These values are produced by the
two special functions true and false. They are also produced by two
types of MATLAB operators: relational operators and logic operators.
Logical values are stored in a single byte of memory, so they take up
much less space than numbers.
it is legal in MATLAB to mix numerical and logical data in
expressions. If a logical value is used in a place where a numerical
value is expected, then true values are converted to the number 1 and
false values are converted to the number 0, and these numbers are used
in the calculations.
**Relational and Logic Operators
Relational operators are operators that compare two numbers and
produce a true or false result. For example, a > b is a relational operator
that compares the numbers in variables a and b. If the value in a is
greater than the value in b, then this operator returns a true result.
Otherwise, the operator returns a false result.
Logic operators are operators that compare one or two logical values
and produce a true or false result. For example, && is a logical AND
operator. The operator a && b compares the logical values stored in
variables a and b. If both a and b are true (nonzero), then the operator
returns a true result. Otherwise, the operator returns a false result.
**Logic Operators
EX:-
**The if Construct
EX:-
**As an example of an if construct, consider the solution of a quadratic
equation of the form
Ax2 - + bx + c = 0
The solution to this equation is