Le variabili predefinite in MATLAB

In MATLAB possono essere usate diverse variabili predefinite, alcune sono riferite all’aritmetica floating-point dell’elaboratore usato ( eps, inf, NaN , realmax, realmin), altre forniscono valori di costanti note (pi, i, j).

» format long , pi

ans = 3.14159265358979

» help i

I Imaginary unit.

As the basic imaginary unit   SQRT(-1),  i and j are used to enter complex numbers. For example, the expressions   3+2i,  3+2*i,  3+2i,   3+2*j   and  3+2*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 loops, etc.

See also J.

» format short, j

ans = 0+ 1.0000i

»

» help eps

EPS Floating point relative accuracy.

EPS returns the distance from 1.0 to the next largest floating point number. EPS is used as a default tolerance by PINV and RANK, as well as several other MATLAB functions.

See also REALMAX, REALMIN.

» format long , eps

ans = 2.220446049250313e-016

»




Alba C. Simoncelli - MATLAB (nov. 2002) - pag. 6b                              Indice    Pag. Prec.    Pag. Seg.