Tool/software:
I bought a EEG signal generator that can generate low-frequency small signals, and I want to verify the correctness of my acquisition board. The signal generator is set to output a sine signal with an amplitude of 50UV and a frequency of 10Hz. Then my acquisition board went to collect and displayed the waveform. The amplitude was correct, but there was an offset. And the frequency is incorrect, around 20hz. Then I tried a sine signal with a frequency of 4 Hz and collected results with a frequency of 9 Hz. May I ask what the reason is? My ADS1299 has a sampling rate set to 250Hz and a gain of 24. I saved the data of channel one as a CSV file and processed it using Python. Here is my code:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
data = pd.read_csv(r'C:\Users\sun\Desktop\250-4.csv')
voltage = data['Voltage'].values
fs = 250
n = len(voltage)
t = np.arange(n) / fs
fft_result = np.fft.fft(voltage)
fft_freq = np.fft.fftfreq(n, 1/fs)
positive_freqs = fft_freq[:n//2]
positive_fft = np.abs(fft_result[:n//2]) * (2/n) # 归一化
plt.figure(figsize=(10, 5))
plt.subplot(2, 1, 1)
plt.plot(t, voltage)
plt.title('Original Voltage Waveform')
plt.xlabel('Time (s)')
plt.ylabel('Voltage (V)')
plt.grid()
plt.subplot(2, 1, 2)
plt.plot(positive_freqs, positive_fft)
plt.title('FFT of the Voltage Signal')
plt.xlabel('Frequency (Hz)')
plt.ylabel('Magnitude')
plt.xlim(0, fs/2)
plt.grid()
plt.tight_layout()
plt.show()