Electronic Engineer Discuss

View: 3934|Reply: 2
Print Prev. thread Next thread

A/C and D/C coupling support

[Copy link]

1

Threads

8

Posts

8

Credits

新手上路

Rank: 1

Credits
8
1#
Post time 2023-7-4 17:00:13 | Show all posts
a/c coupling can achieve in digital way. like this:

  1. #信号去除0点:
  2. def dc2ac(signal):
  3.     # 下面,将对应信号转至频域消除0点后转回时域
  4.     x = signal
  5.     # 傅里叶变换
  6.     X = np.fft.fft(x)  # 计算原始信号的傅里叶变换
  7.     # 去除直流分量
  8.     X[0] = 0;
  9.     # 幅角变换
  10.     phase_shift = np.zeros(len(X))
  11.     phase_shift[len(X)//2] = -np.angle(X[len(X)//2])
  12.     X_corrected = X * np.exp( 1j * phase_shift)
  13.     # 转回时域
  14.     x_withoutDC = np.real(np.fft.ifft(X_corrected));
  15.     return x_withoutDC;
Copy the Code

You have to log in before you can reply Login | Register

Points Rules

Dark room|Mobile|Archiver|Electronic Engineer Discuss

2024-5-5 17:49 GMT+8 , Processed in 0.154687 second(s), 19 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

Quick Reply To Top Return to the list