| Signal Processing Toolbox | ![]() |
Syntax
y = abs(x)
Description
y = abs(x)
returns the absolute value of the elements of x. If x is complex, abs returns the complex modulus (magnitude).
abs(x) = sqrt(real(x).^2 + imag(x).^2)
If x is a MATLAB string, abs returns the numeric values of the ASCII characters in the string. The display format of the string changes; the internal representation does not.
The abs function is part of the standard MATLAB language.
Example
Calculate the magnitude of the FFT of a sequence.
t=(0:99)/100; % time vector x=sin(2*pi*15*t) + sin(2*pi*40*t); % signal y=fft(x); % compute DFT of x m=abs(y); % magnitude
f=(0:length(y)-1)'/length(y)*100; % frequency vector plot(f,m)
See Also
|
Phase angle. |
| Alphabetical List of Functions | ac2poly | ![]() |