abs

September 9th, 2009 Posted in Functions

Absolute value and complex magnitude
Syntax

1
abs(X)

Description

abs(X) returns an array Y such that each element of Y is the absolute value of the corresponding element of X.

X is complex, abs(X) returns the complex modulus (magnitude), is the same as

1
sqrt(real(X).^2 + imag(X).^2)

1
2
3
4
5
6
7
abs(-5)
ans =
     5
 
abs(3+4i)
ans =
     5

See Also

angle, , unwrap

Related posts

Leave a Reply

You must be logged in to post a comment.