# PreBuilt/Built In Variables & Constants in MATLAB Software

## PreBuilt/Built In Variables & Constants in MATLAB Software

ans”
‘ans’ [without quotes] is a pre built variable in MATLAB software that returns the most recent answer that is being calculated.  'ans’ is the variable created automatically when expressions  are not assigned to any other variable name.
Example:- when we simply type ‘2+3’ the result is being displayed as ans=5, that is, the answer is stored in variable ‘ans’

“eps”
“eps”  Variable defines the Spacing of floating point numbers or we can say Floating-point relative accuracy. It can be used as a variable & as well as a function “eps(x)” according to MATLAB official documentation it is “is the positive distance from ABS(X)[Absolute value of X]  to the next larger in magnitude floating point number of the same precision as X.  X may be either double precision or single precision.  For all X, EPS(X) is equal to EPS(ABS(X)).”
It has a default value of  2.2204e-016, you can check it by just typing ‘eps’ in the command prompt window of MATLAB.

Values returned from calling EPS with various inputs are as follows:
Expression                   Return Value
===========================================
eps(0.5)                     1.1102e-016
eps(1)                       2.2204e-016
eps(2)                       4.4409e-016
eps(realmax)           1.9958e+292
eps(0)                       4.9407e-324
eps(Inf)                     NaN (here Inf is Infinity)
eps(NaN)                  NaN(here NaN  is Not A Number particularly for case of 0/0)

Imaginary Unit ‘i’ or ‘j’
They actually used to denote the imaginary values of problems like sqrt(-1). The complex number representation is done by these variables. For example, the expressions 5+8i, 5+8*i, 5+8j, 5+8*j and 5+8*sqrt(-1) all have the same value.
Since both i and j are functions, they can be overridden and used as a variable.  This permits you to use i or j as an index in FOR, while loops, etc.

NaN (or nan) Not-a-number
This number particularly results from the call of expression 0/0 or infinity/infinity.  It can be expressed as ‘nan’, even though MATLAB is case sensitive. NaN is the IEEE arithmetic representation for Not-a-Number.  A NaN is obtained as a result of mathematically undefined   operations.
Typing as ‘NaN(N)’ will give you an NxN matrix of NaNs.
Typing as ‘NaN(M,N)’ or ‘NaN([M,N])’ will give a MxN matrix of NaNs.

A function names ‘isnan’ is used to find ‘NaN’, will return 1 if the value checked is either positive or negative NaN.

For example, isnan([100 NaN -Inf Inf]) is [0 1 0 0]

Inf (Infinity)
It is  the result of a division by 0, or from an overflow of the value, for example  exp(10000) in MATLAB. INF returns the IEEE arithmetic representation for positive infinity.

Typing as ‘INF(N)’ will give a NxN matrix of INFs.

Typing as ‘INF(M,N)’ or ‘INF([M,N])’ will give a  MxN matrix of INFs.

A function names ‘isinf’ is used to find ‘Inf’, will return 1 if the value checked is either positive or negative infinity.

For example, isinf([200 NaN -Inf Inf]) is [0 0 1 1].

realmax
It is the Largest finite floating point number, that is possible in the machine you are using.
For a 64 bit system it is 1.7977e+308 [ may differ for any other system]

realmin
“realmin” is Smallest positive normalized floating point number. REALMIN returns the smallest positive normalized floating point number in IEEE double precision.
For a 64 bit system it is 2.2251e-308 [ may differ for any other system]

gca
"gca" i.e., get current axis, this value particularly usleful in image processing task, espectally for graph, and particularly histogram representation.

Has a Default Value: 173.0011 (depends on the system)
According to the matlab documentation, GCA returns the handle to the current axis in the current figure. The current axis is the axis that graphics commands like PLOT, TITLE, SURF, etc. draw to if issued.Use the commands AXES or SUBPLOT to change the current axis to a different axis, or to create new ones.