sqrt

Returns the square root of each element of x.

Syntax

R = sqrt(x)

Inputs

x
Any valid scalar | vector | matrix.
Type: double | integer | logical | struct | cell
Dimension: scalar | vector | matrix

Outputs

R
Square root.

Examples

Scalar input:
R = sqrt(9)
R = 3
Complex input:
R = sqrt(3i)
R = 1.22474 + 1.22474i
Matrix input:
R = sqrt([2,4,9])
R = [ 1.41421 2 3 ]
Complex matrix input:
R = sqrt([3i, 4i, -2, 2])
R = [ 1.22474 + 1.22474i, 1.41421 + 1.41421i, 1.41421i, 1.41421]

Comments

If x is a complex sqrt(a+bi) finds p and q such that (p + qi)^2 = a + bi.