Skip to Main Content Skip to Search
Product Documentation

abs - Absolute value (magnitude)

Description

abs is a MATLAB® function.

Examples

Calculate the magnitude of the DFT of a sequence:

t = (0:99)/100;                        % Time vector
x = sin(2*pi*15*t) + sin(2*pi*40*t);   % Signal
y = fft(x);                            % DFT of x
m = abs(y);                            % Magnitude
m=m(1:51);											% Unique magnitudes

Plot the magnitude:

f=0:50;     % Frequency vector
plot(f,m);
ylabel('Magnitude'); xlabel('Hz');

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

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