Variables, Numbers, Operators and Functions
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 ...