import numpy as np
import matplotlib.pyplot as plt
# Constants
beta = 2 * np.pi / 0.3 # Assuming a wavelength λ = 0.3 for demonstration
z_values = np.linspace(0, 0.3, 500) # Position along the transmission line
ZL = 50 + 30j # Load impedance (example values)
ZS = 75 # Source impedance (example value)
Gamma_0 = 0.2 + 0.6j # Initial reflection coefficient (example value)
# Calculating input impedance Z_in(z) and reflection coefficient Gamma(z)
Z_in = ZS * (ZL + 1j * ZS * np.tan(beta * z_values)) / (ZS + 1j * ZL * np.tan(beta * z_values))
Gamma = Gamma_0 * np.exp(-2j * beta * z_values)
# Normalize the input impedance for Smith Chart
Z_norm = Z_in / ZS
# Plot Reflection Coefficient
plt.figure(figsize=(10, 5))
plt.subplot(1, 2, 1)
plt.plot(z_values, np.abs(Gamma), label='Reflection Coefficient |Γ(z)|')
plt.xlabel('Position z (m)')
plt.ylabel('Magnitude of Γ(z)')
plt.title('Reflection Coefficient |Γ(z)| vs Position z')
plt.grid(True)
plt.legend()
# Plot Input Impedance Z_in(z)
plt.subplot(1, 2, 2)
plt.plot(z_values, np.real(Z_in), label='Real(Z_in(z))')
plt.plot(z_values, np.imag(Z_in), label='Imag(Z_in(z))')
plt.xlabel('Position z (m)')
plt.ylabel('Impedance Z_in(z) (Ω)')
plt.title('Input Impedance Z_in(z) vs Position z')
plt.grid(True)
plt.legend()
plt.tight_layout()
plt.show()
# Alternative Smith Chart Plot using Polar Coordinates
plt.figure(figsize=(8, 8))
plt.polar(np.angle(Z_norm), np.abs(Z_norm), label='Normalized Impedance Z_norm(z)')
plt.title('Alternative Smith Chart (Polar Plot) of Normalized Impedance')
plt.legend()
plt.show()
# Impedance Chart (Real vs Imaginary parts)
plt.figure(figsize=(8, 6))
plt.plot(np.real(Z_in), np.imag(Z_in), label='Z_in(z)')
plt.xlabel('Real Part of Z_in(z) (Ω)')
plt.ylabel('Imaginary Part of Z_in(z) (Ω)')
plt.title('Impedance Chart')
plt.grid(True)
plt.legend()
plt.show()
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme