abs - Absolute value (magnitude)

Description

abs is a MATLAB® function.

Signal-Specific 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

Plot the magnitude:

f = (0:length(y)-1)'/length(y)*100;    % Frequency vector
plot(f,m)
  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS