September 2014
Intermediate to advanced
180 pages
3h 14m
English
CHAPTER 2
![]()
Variables, Numbers, Operators and Functions
Variables
MATLAB does not require a command to declare variables. A variable is created simply by directly allocating a value to it. For example:
>> v = 3v =3
The variable v will take the value 3 and using a new mapping will not change its value. Once the variable is declared, we can use it in calculations.
>> v ^ 3ans =27>> v + 5ans =8
The value assigned to a variable remains fixed until it is explicitly changed or if the current MATLAB session is closed.
If we now write:
>> v = 3 + 7v =10
then the variable v has the value 10 from now on, as shown in the following calculation:
>> v ^ 4ans ...
Read now
Unlock full access