Graphics Programs Reference
In-Depth Information
Variables
Variable names, which must start with a letter, are case sensitive . Hence xstart and
xStart representtwo different variables. The length of the name is unlimited, but
only the first N characters aresignificant. To find N foryour installation of MATLAB,
use the command namelengthmax :
>> namelengthmax
ans =
63
Variables that are definedwithin a MATLAB functionare local in their scope.
Theyare not available to other parts of the program and do not remain in memory
after exiting the function (this applies to most programming languages). However,
variables canbesharedbetweenafunctionand the callingprogramif theyare declared
global .For example, by placing the statement global X Y in a functionas well as
the calling program, the variables X and Y aresharedbetween the two program units.
The recommendedpractice istouse capital lettersforglobal variables.
MATLABcontainsseveralbuilt-inconstants andspecial variables,most important
of which are
Default nameforresults
ans
Smallest number forwhich 1 + eps
>
eps
1
inf Infinity
NaN Not a number
iorj
1
π
realmin Smallest usable positive number
realmax Largest usable positive number
pi
Here are a few of examples:
>> warning off % Suppresses print of warning messages
>> 5/0
ans =
Inf
>> 0/0
Search WWH ::




Custom Search