Professional Documents
Culture Documents
01/01/2023
Arithmetic Statements
For example, the following are all examples of arithmetic statements in MATLAB:
y = 3 + 5
z = x * y
a = b / c
d = a ^ 2
In MATLAB, variables that appear on the right side of an arithmetic statement can be
constants, variables that have been previously defined, or expressions that evaluate to a
numeric value.
x = 2 + y
x = (a + b) * c
It's important to note that, in order for an arithmetic statement to be valid in MATLAB,
the values on the right side of the statement must be numeric (either constants or
variables that have been previously defined with numeric values).
If any of the values are non-numeric (such as text strings or logical values), the
statement will produce an error.