I'm very new to signal processing and can't get ahead:
I'm using an Accelerometer to measure the acceleration of i.e. the building vibrations or elements/machinery etc. For creating the spectrum, I complete a fft, with python's numpy, and there reach at the state where my problem lays. I have 2 problems understanding the process of creating the frequency spectrum:

  1. The scaling of the y-axis, happening in the fft
  2. How does one get from the acceleration data to the rms velocity used for the VC (vibration criteria) curves (example at the end).

To clarify my problem let me create a minimalist and easy example:
Here is a small code which creates a default spectrum from a single sine wave: Let's say that the sine has an Amplitude of 1 m/s², so the unit of the spectrum should also be in m/s², and the time is in seconds.

import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure(figsize=(8, 8))
ax = fig.add_subplot(211)
ax_ps = fig.add_subplot(212)

samp_freq = 1000
rate = 1/samp_freq
t = np.arange(0,1,rate) #s
func = 1*np.sin(2*np.pi*t*50) #50 Hz
fr = np.fft.rfftfreq(len(func),rate)
ft = abs(np.fft.rfft(func))


This restults in the following plots: enter image description here
As it should, it detects the 50$\,$Hz frequency without problems. Yet, I don't understand the enormous value of the y-axis of 500 (m/s²). The only thing I see is, that the value is dependent on both the sample rate and measuring time, as it rises with both individually. But the bigger problem - also connected to 1 - is part 2: how do I get from this spectrum to one, comparable with the following (not the layout, only the scaling of the y-axis): enter image description here

I hope the question got clear, if not, please let me know.


1 Answer 1


The scaling of the FFT depends on the specific implementation but most commonly I have found it to be done by dividing by the number of samples. This is the case for the fft in MATLAB, Octave and Python scipy.signal, and in the OP's example. Here he used $1000$ samples and got a result of $500$ for the FFT result. This makes perfect sense once we realize that the FFT does not return coefficients of sines and cosines, but instead returns the coefficients of exponentials of constant magnitude rotating in time at a constant rate (frequency). Know that the general form $Ae^{\phi}$ is simply a complex phasor of magnitude $A$ and angle $\phi$, thus the potentially confusing expression $e^{j\omega t}$ is a phasor which magnitude one, rotating in time at a constant rate $\omega$ radians/sec.

Euler's identity shows the OP's example best. From Euler's we see that:

$$cos(\omega t) = \frac{1}{2}e^{j\omega t} + \frac{1}{2}e^{-j\omega t}$$

If we scale the OP's result by $N=1000$, we get $\frac{1}{2}$ which is exactly the coeffiicents of each the exponential terms within the signal. The Fourier Transform itself decomposes arbitrary signals into each of its $e^{j \omega t}$ terms, either as a continuous function for waveforms of infinite duration without repetition, or as discrete terms when repetition exists. The DFT is similar when we consider the finite duration sampled time domain signal will have the same mathematical result in the Fourier Transform as a signal that repeats over that same interval extending to infinity in time, with the distinction that the frequency domain result will be continuous but will be zero every where except at the non-zero DFT results.

Proper scaling of the FFT result gets complicated when we window and when we want accurate measurements of broadband signals that occupy many bins (random noise vibration testing versus sinusoidal vibration testing for example). I detail the important considerations of "equivalent noise bandwidth" and the effects of windowing at this post.

  • $\begingroup$ I unterstand what you are saying but I can't grasp the connection to the unit. I still want to later create with the spectrum the given second image. Hence, I need a unadulterated scaling on the y-axis; so how do I get there (only for the acceleration is fine too)? $\endgroup$ Commented Dec 3, 2021 at 10:10
  • $\begingroup$ @Wolfmercury I'm confused by your continued question: You say you produce a sine wave that has units of 1 m/s^2, and you are asking why the FFT result is so large and why it doesn't also show 1 m/s^2? From my answer, you concur that the FFT is showing both components, so we get 1/2 m/s^2 on each for the total 1 m/s^2 you desire. Given any real time domain signal, we can ignore the negative frequency component and double the positive-- which you can do here an simply scale by $N/2$. Please let me know what is still confusing you. $\endgroup$ Commented Dec 3, 2021 at 12:25
  • 1
    $\begingroup$ You were right, I was still confused and made a mistake in my head. Thank you! $\endgroup$ Commented Dec 3, 2021 at 12:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.