The below is a graph my designed constant current source. enter image description here

You can clearly see that there are some noise in the values.

But when I take the FFT, the noise is not actually showing in graph.

enter image description here

Could some tell me why is it so? I am newbie here. Please spare me if I am wrong.

Below is my python code for FFT.


import numpy as np
import pandas as pd

import matplotlib.pyplot as plt
from scipy.fft import fft, fftfreq

file_path ="location"
data = pd.read_csv(file_path)

# Extract the current values
current = data['Current (mA)'].values

# Compute the FFT for real-valued data
yf = fft(current)

# Compute the corresponding frequency values
N = len(current)
SAMPLE_RATE = 200 # Sampling rate based on 0.005 s sampling interval

xf = fftfreq(N, 1 / SAMPLE_RATE)

# Plot the frequency domain representation
plt.plot(xf, np.abs(yf))

plt.xlabel('Frequency (Hz)')
plt.title('Frequency Domain Representation')

Mean graph. Subtracted the mean from values enter image description here

  • $\begingroup$ Your Y-axis is hard to read. What exactly does "+2.106e1" at the top mean ? Chances are this is a huge DC offset or bias. $\endgroup$
    – Hilmar
    Aug 10, 2023 at 12:26
  • $\begingroup$ @Hilmar: It is the output of a constant current circuit designed for 21mA. So the values is around 21.061mA to 21.068mA $\endgroup$
    – Teena
    Aug 10, 2023 at 12:29
  • $\begingroup$ So yes: you have a HUGE DC signal with a tiny little bit of noise on top. You need to subtract the bias out before doing the FFT $\endgroup$
    – Hilmar
    Aug 10, 2023 at 13:37
  • 2
    $\begingroup$ It would also help if you could plot your spectrum logarithmically in dB. Than you can easily see where the DC drift ends and the noise starts in frequency. Make sure that your frequency axis is correct as well. It certainly isn't in the first graph $\endgroup$
    – Hilmar
    Aug 10, 2023 at 13:41

2 Answers 2


You will need a DC blocker. You have a huge bias but it's not single constant value but drifting around a bit. Hence your spectrum is dominated by very low frequencies (which is the DC offset and it's drift). Try a high pass at 1/100th of a Hz or so (depending on your sample rate)


Compute the average (the mean) of your original time-domain samples. Next, subtract that single average value from each of your time samples. Then compute the FFT of the subtraction result.

  • $\begingroup$ I did your suggestion. But even then the noise is not distinguishable. Is it because the noise very very low? $\endgroup$
    – Teena
    Aug 10, 2023 at 12:36
  • 1
    $\begingroup$ On the opposite, there is virtually no signal, just noise. $\endgroup$
    – user67664
    Aug 10, 2023 at 15:38
  • $\begingroup$ @Teena: What is the time duration of your signal (measured in seconds) and what is your signal sample rate (measured in samples per second)? $\endgroup$ Aug 12, 2023 at 8:40
  • $\begingroup$ @RichardLyons: I have measured the signal at every 5ms. The signal is the output of a constant current circuit using an opamp. I need to analyse the noise and remove it using an RC filter. $\endgroup$
    – Teena
    Aug 17, 2023 at 10:18

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.