Main Content

Constants and Test Matrices

Pi, Not-a-Number, infinity; Hadamard, companion, Pascal, and other specialized matrices

MATLAB® provides several constants, test matrices, and other named matrices as well as functions to examine array elements. You can use these constants, matrices, and functions to test your code and check if your computations return the intended results.

Functions

expand all

epsFloating-point relative accuracy
flintmaxLargest consecutive integer in floating-point format
iImaginary unit
jImaginary unit
InfCreate array of all Inf values
piRatio of circle's circumference to its diameter
NaNCreate array of all NaN values
companCompanion matrix
galleryTest matrices
hadamardHadamard matrix
hankelHankel matrix
hilbHilbert matrix
invhilbInverse of Hilbert matrix
magicMagic square
pascalPascal matrix
rosserClassic symmetric eigenvalue test problem
toeplitzToeplitz matrix
vanderVandermonde matrix
wilkinsonWilkinson's eigenvalue test matrix
allfiniteDetermine if all array elements are finite (Since R2022a)
anynanDetermine if any array element is NaN (Since R2022a)
isfiniteDetermine which array elements are finite
isinfDetermine which array elements are infinite
isnanDetermine which array elements are NaN

Topics