The square root function in MATLAB is sqrt(a), where a is a numerical scalar, vector or array. The square root function returns the positive square root b of each element of the argument a, such that b x b = a.
The function sqrt() takes positive, negative and complex numbers as arguments. If the argument is negative or complex, sqrt() returns a complex number in the form a + bi, where a and b are real numbers, and i is the square root of -1, an imaginary number. MATLAB also contains the square root function realsqrt(). This function performs the same calculation as sqrt(), but the arguments are limited to arrays of real, non-negative numbers. Another square root function in MATLAB is the matrix square root sqrtm(), which can only be applied to numerical matrices. The square root of a matrix A is another matrix B of the same dimensions such that the matrix product of B with itself is equal to A. Thus, B x B = A. Sqrtm(A) returns the positive, definite matrix square root of A, which is the matrix square root of A with eigenvalues that are non-negative or, for complex eigenvalues, have non-negative, real parts. In general, a matrix has several unique matrix square roots.