Page 22 - MATLAB an introduction with applications
P. 22
MATLAB Basics ——— 7
Table 1.9 Predefined variables
Predefined variable Description
in MATLAB
ans Represents a value computed by an expression but not
stored in variable name.
pi Represents the number π.
eps Represents the floating-point precision for the computer
being used. This is the smallest difference between two
numbers.
inf Represents infinity which for instance occurs as a result of
a division by zero. A warning message will be displayed or
the value will be printed as ∞.
i Defined as − , which is: 0 + 1.0000 .i
1
j Same as .
i
NaN Stands for Not a Number. Typically occurs as a result of an
expression being undefined, as in the case of division of
zero by zero.
clock Represents the current time in a six-element row vector
containing year, month, day, hour, minute, and seconds.
date Represents the current date in a character string format.
1.7 COMMANDS FOR MANAGING VARIABLES
Table 1.10 lists commands that can be used to eliminate variables or to obtain information about variables that
have been created. The procedure is to enter the command in the Command Window and the Enter key is to be
pressed.
Table 1.10 Commands for managing variables
Command Description
clear Removes all variables from the memory.
clear x, y, z Clears/removes only variables x, y and z from the memory.
who Lists the variables currently in the workspace.
whos Displays a list of the variables currently in the memory and their
size together with information about their bytes and class.
1.8 GENERAL COMMANDS
In Tables 1.11 to 1.15 the useful general commands on on-line help, workspace information, directory information
and general information are given.
F:\Final Book\Sanjay\IIIrd Printout\Dt. 10-03-09