0
2

スイッチトキャパシタの伝達関数

Last updated at Posted at 2024-07-03

image.png

image.png
http://integratedsys.web.fc2.com/other/SC.pdf

import numpy as np
import matplotlib.pyplot as plt
from scipy import signal

# フィルタのパラメータ
C1 = 100e-12  # 100 pF
C2 = 10e-12   # 10 pF

# サンプリング周波数
fs = 1000.0  # サンプリング周波数 [Hz]

# クロール型の伝達関数
num_cascade = [-(C1/C2), 0]
den_cascade = [1, -(1 - (C1/C2))]
sys_cascade = signal.TransferFunction(num_cascade, den_cascade, dt=1/fs)

# バタフライ型の伝達関数
num_butterfly = [-(C1/C2), 0]
den_butterfly = [1, 1 - (C1/C2)]
sys_butterfly = signal.TransferFunction(num_butterfly, den_butterfly, dt=1/fs)

# インパルス応答を計算
t_impulse, y_impulse = signal.dimpulse(sys_cascade)
t_impulse_b, y_impulse_b = signal.dimpulse(sys_butterfly)

# プロット
plt.figure()
plt.subplot(2, 1, 1)
plt.stem(t_impulse, y_impulse[0])
plt.title('Cascade Type Impulse Response')
plt.xlabel('Time [samples]')
plt.ylabel('Amplitude')
plt.grid()

plt.subplot(2, 1, 2)
plt.stem(t_impulse_b, y_impulse_b[0])
plt.title('Butterfly Type Impulse Response')
plt.xlabel('Time [samples]')
plt.ylabel('Amplitude')
plt.grid()

plt.tight_layout()
plt.show()

import numpy as np
import matplotlib.pyplot as plt
from scipy import signal

# フィルタのパラメータ
C1 = 100e-12  # 100 pF
C2 = 10e-12   # 10 pF

# サンプリング周波数
fs = 1000.0  # サンプリング周波数 [Hz]

# クロール型の伝達関数
num_cascade = [-(C1/C2), 0]
den_cascade = [1, -(1 - (C1/C2))]
sys_cascade = signal.TransferFunction(num_cascade, den_cascade, dt=1/fs)

# バタフライ型の伝達関数
num_butterfly = [-(C1/C2), 0]
den_butterfly = [1, 1 - (C1/C2)]
sys_butterfly = signal.TransferFunction(num_butterfly, den_butterfly, dt=1/fs)

# 周波数応答の計算
w_cascade, mag_cascade, phase_cascade = sys_cascade.bode()
w_butterfly, mag_butterfly, phase_butterfly = sys_butterfly.bode()

# プロット
plt.figure()
plt.subplot(2, 1, 1)
plt.semilogx(w_cascade, mag_cascade)
plt.title('Cascade Type Discrete Bode Plot')
plt.xlabel('Frequency [rad/sample]')
plt.ylabel('Magnitude [dB]')
plt.grid()

plt.subplot(2, 1, 2)
plt.semilogx(w_cascade, phase_cascade)
plt.title('Phase')
plt.xlabel('Frequency [rad/sample]')
plt.ylabel('Phase [degrees]')
plt.grid()

plt.tight_layout()

plt.figure()
plt.subplot(2, 1, 1)
plt.semilogx(w_butterfly, mag_butterfly)
plt.title('Butterfly Type Discrete Bode Plot')
plt.xlabel('Frequency [rad/sample]')
plt.ylabel('Magnitude [dB]')
plt.grid()

plt.subplot(2, 1, 2)
plt.semilogx(w_butterfly, phase_butterfly)
plt.title('Phase')
plt.xlabel('Frequency [rad/sample]')
plt.ylabel('Phase [degrees]')
plt.grid()

plt.tight_layout()
plt.show()

import numpy as np
import matplotlib.pyplot as plt
from scipy import signal

# Define the transfer function parameters
C1 = 1e-12  # 1 pF
C2 = 1e-12  # 1 pF
fC = 1e3    # 1 MHz
numerator = [C1 * fC]
denominator = [C2, 0]

# Create the transfer function
system = signal.TransferFunction(numerator, denominator)

# Define the frequency range for the plot
w, mag, phase = signal.bode(system)

# Plot the magnitude response
plt.figure()
plt.semilogx(w, mag)
plt.title('Bode Plot of Sample and Hold Circuit')
plt.xlabel('Frequency [rad/s]')
plt.ylabel('Magnitude [dB]')
plt.grid(True, which='both', linestyle='--', linewidth=0.5)

# Plot the phase response
plt.figure()
plt.semilogx(w, phase)
plt.title('Phase Plot of Sample and Hold Circuit')
plt.xlabel('Frequency [rad/s]')
plt.ylabel('Phase [degrees]')
plt.grid(True, which='both', linestyle='--', linewidth=0.5)

# Show the plots
plt.show()

image.png

image.png

image.png

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2