hypot

Returns the element-wise square root of the sum of the squares of x and y.

Syntax

R = hypot(x,y)

Inputs

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

Outputs

R
scalar | vector | matrix

Examples

Simple hypot example:
hypot(-8,4)
R = 8.9443
Complex hypot example:
hypot(7,2-8i)
R = 10.817
Matrix hypot example:
hypot(5,[1,6,3;8,-2,3])
R = [ 5.099 7.8102 5.831 ; 9.434 5.3852 5.831 ]
Complex matrix hypot example:
hypot([i,9,2-2i;1+i,4-i,-6],2i-1)
R = [ 2.4495 9.2736 3.6056 ; 2.6458 4.6904 6.4031 ]

Comments

hypot(x,y) = sqrt(x.^2 + y.^2)