Going from the time doain to the frequncy domain, why the amplitude of the signal is increased?

3 views (last 30 days)
Hi All,
I have a time-depended signal (vector signal.mat and time.mat). In particular, I know the signal values are accelerations, sampled at 200 Hz and the signal is a real machine output so it contains noise.
My aim is to go from the time domain to the frequency domain, to see the spectrum and "later" to filter the data from the noise.
So, I wish to plot my signal amplitude and phase in the frequency domain and for this I have use the FFT function.
However, I think I did something wrong as I am expecting the signal amplitude in the frequency domain should be in the same range as is the time domain. (For example, if my object accelerates at a max of 5.5 m/s^2 in the time domain, then the same max value should be seen in the frequency domain) But, as you can see from the plots attached, the max acceleration in the time domain is about 5.5 m/s^2. But in the frequency domain the max amplitude is about 200 m/s^2.
That CANNOT BE RIGHT? right????
Below I attached my code so far. Please help me if you can
PS: I am not a great matlab user so please try to think that I am new to this software
Thanks in advance
%%BEGINNING OF THE PROGRAM
load('time.mat'); % load the time domain variable
load('signal.mat'); % load the time-dependent variable (an acceleration in this case)
figure(1) % The following commands plt the signal in the time domain
plot(time,signal);
title('Plot of the signal in the Time Domain')
xlabel('time (sec) ')
ylabel('m/s^2')
grid on
%%Signal Processing
DFT_signal = fft(signal); % Calculate the Discreat Fourier Transform (DFT) of the signal using the Fast Fourier Transform algorithm
N = length(time); % Number of Samples of the signal in the time domain
ts = time(2)-time(1); % Calculate the Sampling Time (sec)
fs = 1/ts; % Calculate the Sampling frequency (Hz) of the signal in the time domain
fuF = fs/N; % Calculate the Fundamental Frequency (Hz) of the signal in the frequency domain
f = [0:fuF:(fs-fuF)/2]'; % Create the frequency domain (Hz). Note that the domain is N/2 because of the DFT symmetry domain.
MAG_DFT = abs(DFT_signal(1:N/2)); % Magnitude of the Signal DFT (m/s^2 ??????)
PHASE_DFT = imag(DFT_signal(1:N/2)); % Phase of the Signal DFT
subplot(2,1,1) % The following commands plt the DFT of the signal in the frequency domain
plot(f,MAG_DFT); % using a figure with two plots
title('Plot of the Signal DFT Magnitude in the Frequency Domain')
xlabel('Frequency (Hz) ')
ylabel('m/s^2')
grid on
subplot(2,1,2)
plot(f,PHASE_DFT/pi()*180);
title('Plot of the Signal DFT Phase in the Frequency Domain')
xlabel('Phase (rad)')
ylabel('m/s^2')
grid on

Answers (1)

Wayne King
Wayne King on 25 Oct 2013
You're missing the scaling of the fft() output by the length of the input signal. That is likely the biggest contributor to why your scale is off. See how a unit amplitude sine wave below ends up as unit magnitude in the frequency domain.
Fs = 1000;
t = 0:1/Fs:1-1/Fs;
x = cos(2*pi*100*t);
L = length(x);
xdft = fft(x)/L;
xdft = xdft(1:L/2+1);
xdft(2:end-1) = 2*xdft(2:end-1);
plot(abs(xdft))
  4 Comments
Giuseppe Naselli
Giuseppe Naselli on 28 Oct 2013
Edited: Walter Roberson on 1 Dec 2015
Hi Waine,
sorry for the late reply but I did not get an email when you answered.
I hope it is not too late.
I have copied the signal and the time variable together with my code on dropbox (I do not know how I can attach files other than pictures here)
However, the time variable is just from 0 to 59.995 sec in step of 0.005sec.
Thanks for your help so far
G

Sign in to comment.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!