-2

I am not from Physics or electrical engineering, so the answers I read related to my only confused me the more. So I asked this case-specific question.

I work with a sensor data (time series). The data consists of sensor values for 4 quantities (4 features), captured at 1 sample per second (1 sec) rate.

I segmented the data into fixed-size samples of 200 time-steps. This data is in time-domain, so I want to obtain the its frequency-domain equivalent. Here's a MWE of how the input data is represented:

import numpy as np
from scipy.fft import fft, fftfreq

X = np.random.rand(5, 200, 4)  # 5 samples in this case, 
X_fft = fft(X, axis=1)         # fft along each dimension of my input (4 features)

magnitude = np.abs(X_fft)

Questions

  1. Does the magnitude calculated above represent the frequency-domain equivalent of my time-domain input?
  2. If answer to 1 is NO, how then do I obtain the frequency-domain?
  3. What is the difference between magnitude and spectrum power?
Amina Umar
  • 502
  • 1
  • 9
  • 1
    Please keep it to one question per post. Question #3 is not about programming, so doesn’t belong here. It would be a good fit for https://dsp.stackexchange.com/ . The answer to #1 is yes. `fftfreq` will give you the corresponding x axis. – Cris Luengo Mar 29 '23 at 13:41

1 Answers1

1
  1. Yes, the magnitude is the Fourier-transform of your input.
  2. When you calculate the Fast-Fourier transform of the sample signal, you are already in the frequency domain. in your code, the magnitude variable is frequencies.
  3. Magnitude is a measure of the amplitude of a signal. It is a scalar quantity that represents the size of a signal. The power spectrum is a measure of how much power is contained in each frequency component of a signal. It is a function that describes how much power is contained in each frequency component of a signal