Practical 2: Variables, Script M-files and Graphing
Naming of Numerical Values in MATLAB
Why would we want to name numerical values? Here is one example: Consider the polynomial function
We could do so by typing in the following:
3^2 + 4*3 + 3
but what if we also want to know the answer when = 7 and = 5? Wouldn’t it be easier to create a name for 3 called as follows:
x = 3
and then evaluate our polynomial function by typing in:
x^2 + 4x + 3
x is what we call a variable.