Signal Processing Toolbox | Help Desk |
abs
Absolute value (magnitude).
y = abs(x)
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.
This function is part of the standard MATLAB environment.
Calculate the magnitude of the FFT of a sequence:
t = (0:99)/100; % time vector x = sin(2Plot the magnitude:*
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)