高频电磁场仿真-主题011-天线基础理论与辐射特性
主题011:天线基础理论与辐射特性
一、引言
天线是射频与微波系统中不可或缺的关键组件,它充当着导波系统与自由空间之间的桥梁,实现电磁能量的有效辐射与接收。无论是通信系统、雷达系统、卫星导航,还是射电天文学,天线都扮演着核心角色。本章将系统介绍天线的基础理论、辐射特性、主要参数以及经典天线类型的分析与设计方法,并通过Python仿真帮助读者深入理解天线的工作原理。




二、基本振子的辐射理论
2.1 电基本振子(赫兹偶极子)
电基本振子是最简单的天线模型,由一段极短的电流元构成。假设电流元长度为dldldl,电流为III,沿zzz轴放置,其电流分布为:
I(z)=I0δ(z)I(z) = I_0 \delta(z)I(z)=I0δ(z)
在球坐标系中,电基本振子的辐射场为:
电场分量:
Er=I0dl2πcosθ(ηr2+1jωϵr3)e−jkrE_r = \frac{I_0 dl}{2\pi} \cos\theta \left(\frac{\eta}{r^2} + \frac{1}{j\omega\epsilon r^3}\right) e^{-jkr}Er=2πI0dlcosθ(r2η+jωϵr31)e−jkr
Eθ=I0dl4πsinθ(jωμr+ηr2+1jωϵr3)e−jkrE_\theta = \frac{I_0 dl}{4\pi} \sin\theta \left(\frac{j\omega\mu}{r} + \frac{\eta}{r^2} + \frac{1}{j\omega\epsilon r^3}\right) e^{-jkr}Eθ=4πI0dlsinθ(rjωμ+r2η+jωϵr31)e−jkr
磁场分量:
Hϕ=I0dl4πsinθ(jkr+1r2)e−jkrH_\phi = \frac{I_0 dl}{4\pi} \sin\theta \left(\frac{jk}{r} + \frac{1}{r^2}\right) e^{-jkr}Hϕ=4πI0dlsinθ(rjk+r21)e−jkr
其中:
- k=ωμϵ=2πλk = \omega\sqrt{\mu\epsilon} = \frac{2\pi}{\lambda}k=ωμϵ=λ2π为波数
- η=μϵ\eta = \sqrt{\frac{\mu}{\epsilon}}η=ϵμ为媒质本征阻抗
- rrr为观察点到振子的距离
2.2 远区场(辐射场)
当kr≫1kr \gg 1kr≫1时,高阶项可以忽略,得到远区场表达式:
Eθ=jηkI0dl4πrsinθ⋅e−jkrE_\theta = j\eta \frac{k I_0 dl}{4\pi r} \sin\theta \cdot e^{-jkr}Eθ=jη4πrkI0dlsinθ⋅e−jkr
Hϕ=jkI0dl4πrsinθ⋅e−jkr=EθηH_\phi = j\frac{k I_0 dl}{4\pi r} \sin\theta \cdot e^{-jkr} = \frac{E_\theta}{\eta}Hϕ=j4πrkI0dlsinθ⋅e−jkr=ηEθ
关键特性:
- 远区场是横电磁波(TEM波),EθE_\thetaEθ与HϕH_\phiHϕ相互垂直
- 场强与距离rrr成反比(球面波特性)
- 方向性函数为sinθ\sin\thetasinθ,在θ=90°\theta = 90°θ=90°方向辐射最强
2.3 磁基本振子(小电流环)
磁基本振子是与电基本振子对偶的天线模型,可以用小电流环实现。设环面积为SSS,电流为I0I_0I0:
远区场:
Eϕ=ηk2I0S4πrsinθ⋅e−jkrE_\phi = \eta \frac{k^2 I_0 S}{4\pi r} \sin\theta \cdot e^{-jkr}Eϕ=η4πrk2I0Ssinθ⋅e−jkr
Hθ=−k2I0S4πrsinθ⋅e−jkr=−EϕηH_\theta = -\frac{k^2 I_0 S}{4\pi r} \sin\theta \cdot e^{-jkr} = -\frac{E_\phi}{\eta}Hθ=−4πrk2I0Ssinθ⋅e−jkr=−ηEϕ
与电基本振子的对偶关系:
| 电基本振子 | 磁基本振子 |
|---|---|
| EθE_\thetaEθ | EϕE_\phiEϕ |
| HϕH_\phiHϕ | HθH_\thetaHθ |
| 电流元IdlIdlIdl | 磁流元Imdl=jωμISI_m dl = j\omega\mu ISImdl=jωμIS |
三、天线的基本电参数
3.1 方向性函数与方向图
方向性函数描述天线辐射强度随空间角度的变化:
F(θ,ϕ)=∣E(θ,ϕ)∣∣Emax∣F(\theta, \phi) = \frac{|E(\theta, \phi)|}{|E_{max}|}F(θ,ϕ)=∣Emax∣∣E(θ,ϕ)∣
功率方向性函数:
P(θ,ϕ)=∣F(θ,ϕ)∣2P(\theta, \phi) = |F(\theta, \phi)|^2P(θ,ϕ)=∣F(θ,ϕ)∣2
方向图的主要特征:
- 主瓣:包含最大辐射方向的波瓣
- 副瓣:除主瓣外的其他波瓣
- 后瓣:与主瓣方向相反的波瓣
- 零陷:辐射为零的方向
半功率波瓣宽度(HPBW):功率方向图下降到最大值一半(-3dB)时的角度范围。
第一零点波瓣宽度(FNBW):主瓣两侧第一个零点之间的角度。
3.2 方向性系数
方向性系数定义为天线在最大辐射方向的辐射强度与各向同性天线辐射强度的比值:
D=4π∫02π∫0π∣F(θ,ϕ)∣2sinθ dθ dϕD = \frac{4\pi}{\int_0^{2\pi}\int_0^{\pi} |F(\theta, \phi)|^2 \sin\theta \, d\theta \, d\phi}D=∫02π∫0π∣F(θ,ϕ)∣2sinθdθdϕ4π
常见天线的方向性系数:
- 电基本振子:D=1.5D = 1.5D=1.5(1.76 dBi)
- 半波振子:D=1.64D = 1.64D=1.64(2.15 dBi)
- 理想点源:D=1D = 1D=1(0 dBi)
3.3 增益与效率
天线增益考虑天线损耗后的方向性:
G=ηrad⋅DG = \eta_{rad} \cdot DG=ηrad⋅D
其中ηrad\eta_{rad}ηrad为辐射效率:
ηrad=PradPin=PradPrad+Ploss\eta_{rad} = \frac{P_{rad}}{P_{in}} = \frac{P_{rad}}{P_{rad} + P_{loss}}ηrad=PinPrad=Prad+PlossPrad
PradP_{rad}Prad为辐射功率,PlossP_{loss}Ploss为损耗功率(导体损耗、介质损耗等)。
增益与方向性的关系:
- 理想无损天线:G=DG = DG=D
- 实际天线:G<DG < DG<D
- 增益单位:dBi(相对于各向同性天线)或dBd(相对于半波振子)
3.4 输入阻抗与带宽
输入阻抗:
Zin=Rin+jXin=Rr+Rl+jXinZ_{in} = R_{in} + jX_{in} = R_r + R_l + jX_{in}Zin=Rin+jXin=Rr+Rl+jXin
其中:
- RrR_rRr:辐射电阻
- RlR_lRl:损耗电阻
- XinX_{in}Xin:输入电抗
辐射电阻:
对于电基本振子:
Rr=80π2(dlλ)2R_r = 80\pi^2 \left(\frac{dl}{\lambda}\right)^2Rr=80π2(λdl)2
对于半波振子:
Rr≈73.1 ΩR_r \approx 73.1 \, \OmegaRr≈73.1Ω
带宽定义:
- 阻抗带宽:∣S11∣<−10|S_{11}| < -10∣S11∣<−10 dB(VSWR < 2)的频率范围
- 方向图带宽:方向图特性满足要求的频率范围
- 增益带宽:增益下降不超过3dB的频率范围
相对带宽:
BW=fupper−flowerfc×100%BW = \frac{f_{upper} - f_{lower}}{f_c} \times 100\%BW=fcfupper−flower×100%
3.5 极化特性
极化描述电场矢量端点随时间变化的轨迹:
线极化:
- 电场矢量沿固定方向振荡
- 水平极化(H):电场平行于地面
- 垂直极化(V):电场垂直于地面
圆极化:
- 电场矢量端点描绘圆
- 左旋圆极化(LHCP):逆时针旋转
- 右旋圆极化(RHCP):顺时针旋转
椭圆极化:
- 电场矢量端点描绘椭圆
- 轴比(AR):椭圆长轴与短轴之比
- AR = 1时为圆极化,AR = ∞时为线极化
极化效率:
ηp=∣ρ^t⋅ρ^r∣2\eta_p = |\hat{\rho}_t \cdot \hat{\rho}_r|^2ηp=∣ρ^t⋅ρ^r∣2
其中ρ^t\hat{\rho}_tρ^t和ρ^r\hat{\rho}_rρ^r分别为发射和接收天线的极化单位矢量。
四、天线阵列理论
4.1 阵列因子
由NNN个相同天线单元组成的阵列,其总辐射场为:
Etotal=Eelement⋅AFE_{total} = E_{element} \cdot AFEtotal=Eelement⋅AF
其中AFAFAF为阵列因子:
AF=∑n=0N−1Inej(nkdcosθ+βn)AF = \sum_{n=0}^{N-1} I_n e^{j(nkd\cos\theta + \beta_n)}AF=n=0∑N−1Inej(nkdcosθ+βn)
对于等幅等间距阵列:
AF=∑n=0N−1ejn(kdcosθ+β)=sin[N2(kdcosθ+β)]sin[12(kdcosθ+β)]AF = \sum_{n=0}^{N-1} e^{jn(kd\cos\theta + \beta)} = \frac{\sin\left[\frac{N}{2}(kd\cos\theta + \beta)\right]}{\sin\left[\frac{1}{2}(kd\cos\theta + \beta)\right]}AF=n=0∑N−1ejn(kdcosθ+β)=sin[21(kdcosθ+β)]sin[2N(kdcosθ+β)]
其中:
- ddd:单元间距
- β\betaβ:相邻单元间的相位差
- NNN:单元数
4.2 阵列方向性控制
主瓣方向:
由相位差控制:
θ0=arccos(−βkd)\theta_0 = \arccos\left(-\frac{\beta}{kd}\right)θ0=arccos(−kdβ)
波束扫描:
通过改变相位差β\betaβ,可以实现波束的电扫描。
栅瓣条件:
为避免栅瓣,单元间距需满足:
d<λ1+∣cosθ0∣d < \frac{\lambda}{1 + |\cos\theta_0|}d<1+∣cosθ0∣λ
对于边射阵列(θ0=90°\theta_0 = 90°θ0=90°):d<λd < \lambdad<λ
对于端射阵列(θ0=0°\theta_0 = 0°θ0=0°):d<λ/2d < \lambda/2d<λ/2
4.3 常见阵列配置
边射阵列:
- 主瓣垂直于阵列轴
- 相位差β=0\beta = 0β=0
- 最大辐射方向θ=90°\theta = 90°θ=90°
端射阵列:
- 主瓣沿阵列轴方向
- 相位差β=−kd\beta = -kdβ=−kd
- 最大辐射方向θ=0°\theta = 0°θ=0°
扫描阵列:
- 主瓣指向任意角度
- 相位差β=−kdcosθ0\beta = -kd\cos\theta_0β=−kdcosθ0
五、经典天线类型
5.1 半波振子天线
半波振子是最基本实用的线天线,长度L=λ/2L = \lambda/2L=λ/2。
电流分布(近似正弦分布):
I(z)=I0sin[k(L2−∣z∣)]I(z) = I_0 \sin\left[k\left(\frac{L}{2} - |z|\right)\right]I(z)=I0sin[k(2L−∣z∣)]
远区场:
Eθ=jηI02πrcos(π2cosθ)sinθe−jkrE_\theta = j\eta \frac{I_0}{2\pi r} \frac{\cos\left(\frac{\pi}{2}\cos\theta\right)}{\sin\theta} e^{-jkr}Eθ=jη2πrI0sinθcos(2πcosθ)e−jkr
主要参数:
- 输入阻抗:Zin≈73.1+j42.5 ΩZ_{in} \approx 73.1 + j42.5 \, \OmegaZin≈73.1+j42.5Ω
- 方向性系数:D=1.64D = 1.64D=1.64(2.15 dBi)
- HPBW:78°78°78°
- 辐射电阻:Rr=73.1 ΩR_r = 73.1 \, \OmegaRr=73.1Ω
5.2 单极子天线
单极子天线是半波振子的变形,使用地面镜像原理。
特性:
- 长度:L=λ/4L = \lambda/4L=λ/4
- 输入阻抗:Zin≈36.5+j21.25 ΩZ_{in} \approx 36.5 + j21.25 \, \OmegaZin≈36.5+j21.25Ω
- 方向性系数:D=3.28D = 3.28D=3.28(5.16 dBi)
- 仅上半空间辐射
5.3 八木-宇田天线
八木天线由一个有源振子和多个无源振子(反射器和引向器)组成。
工作原理:
- 反射器(略长于有源振子):反射电磁波
- 引向器(略短于有源振子):引导电磁波
- 形成端射方向图
典型参数(3单元):
- 增益:7-9 dBi
- HPBW:65°65°65°(E面),120°120°120°(H面)
- 前后比:10-15 dB
5.4 微带贴片天线
微带天线由介质基板上的金属贴片和接地板组成。
矩形贴片:
- 谐振长度:L≈λ2ϵr−2ΔLL \approx \frac{\lambda}{2\sqrt{\epsilon_r}} - 2\Delta LL≈2ϵrλ−2ΔL
- 宽度:W≈1.5LW \approx 1.5LW≈1.5L(获得较好辐射效率)
- 输入阻抗:通过馈电位置调节
主要特点:
- 低剖面、重量轻
- 易于共形和集成
- 带宽较窄(1-5%)
- 典型增益:5-8 dBi
5.5 抛物面反射面天线
抛物面天线利用抛物面的几何光学特性实现高增益。
工作原理:
- 馈源位于抛物面焦点
- 球面波经反射后变为平面波
- 形成高方向性波束
增益公式:
G=η(πDλ)2G = \eta \left(\frac{\pi D}{\lambda}\right)^2G=η(λπD)2
其中DDD为抛物面直径,η\etaη为孔径效率(通常0.5-0.7)。
典型参数:
- HPBW:≈70°λD\approx 70° \frac{\lambda}{D}≈70°Dλ
- 增益:与(D/λ)2(D/\lambda)^2(D/λ)2成正比
六、Python天线仿真实现
"""
天线基础理论与辐射特性仿真
包含基本振子、方向图、天线阵列等
"""
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.animation as animation
from matplotlib.patches import Circle, FancyArrowPatch
import warnings
warnings.filterwarnings('ignore')
# 设置中文字体
plt.rcParams['font.sans-serif'] = ['SimHei', 'DejaVu Sans']
plt.rcParams['axes.unicode_minus'] = False
class AntennaTheory:
"""天线理论基础类"""
def __init__(self, frequency):
"""
初始化
参数:
frequency: 频率(Hz)
"""
self.frequency = frequency
self.c = 3e8
self.lambda_ = self.c / frequency
self.k = 2 * np.pi / self.lambda_
self.eta = 377 # 自由空间波阻抗
def hertzian_dipole_field(self, r, theta, I0, dl):
"""
电基本振子远区场
参数:
r: 距离(m)
theta: 极角(rad)
I0: 电流振幅(A)
dl: 振子长度(m)
返回:
E_theta: 电场振幅(V/m)
H_phi: 磁场振幅(A/m)
"""
E_theta = 1j * self.eta * self.k * I0 * dl / (4 * np.pi * r) * np.sin(theta)
H_phi = E_theta / self.eta
return E_theta, H_phi
def half_wave_dipole_field(self, r, theta, I0):
"""
半波振子远区场
参数:
r: 距离(m)
theta: 极角(rad)
I0: 电流振幅(A)
返回:
E_theta: 电场振幅(V/m)
"""
E_theta = 1j * self.eta * I0 / (2 * np.pi * r) * \
np.cos(np.pi/2 * np.cos(theta)) / (np.sin(theta) + 1e-10)
return E_theta
def small_loop_field(self, r, theta, I0, S):
"""
小电流环(磁基本振子)远区场
参数:
r: 距离(m)
theta: 极角(rad)
I0: 电流振幅(A)
S: 环面积(m^2)
返回:
E_phi: 电场振幅(V/m)
"""
E_phi = self.eta * self.k**2 * I0 * S / (4 * np.pi * r) * np.sin(theta)
return E_phi
def array_factor(self, theta, N, d, beta):
"""
均匀线阵阵列因子
参数:
theta: 观察角度(rad)
N: 单元数
d: 单元间距(m)
beta: 相邻单元相位差(rad)
返回:
AF: 阵列因子
"""
psi = self.k * d * np.cos(theta) + beta
AF = np.sin(N * psi / 2) / (np.sin(psi / 2) + 1e-10)
return np.abs(AF)
def directivity(self, theta_range, phi_range, F_pattern):
"""
计算方向性系数
参数:
theta_range: 极角范围
phi_range: 方位角范围
F_pattern: 方向性函数
返回:
D: 方向性系数
"""
# 归一化
F_max = np.max(F_pattern)
F_norm = F_pattern / F_max
# 计算分母(积分)
d_theta = theta_range[1] - theta_range[0]
d_phi = phi_range[1] - phi_range[0]
integral = 0
for i, theta in enumerate(theta_range):
for j, phi in enumerate(phi_range):
integral += (F_norm[i, j]**2) * np.sin(theta) * d_theta * d_phi
D = 4 * np.pi / integral
return D
def create_basic_dipole_analysis():
"""创建基本振子分析"""
fig = plt.figure(figsize=(16, 12))
frequency = 1e9
ant = AntennaTheory(frequency)
# ============ 子图1:电基本振子三维方向图 ============
ax1 = fig.add_subplot(2, 3, 1, projection='3d')
theta = np.linspace(0, np.pi, 50)
phi = np.linspace(0, 2*np.pi, 100)
Theta, Phi = np.meshgrid(theta, phi)
# 电基本振子方向性函数
F_dipole = np.sin(Theta)
# 转换为笛卡尔坐标
X = F_dipole * np.sin(Theta) * np.cos(Phi)
Y = F_dipole * np.sin(Theta) * np.sin(Phi)
Z = F_dipole * np.cos(Theta)
ax1.plot_surface(X, Y, Z, cmap='jet', alpha=0.7)
ax1.set_title('电基本振子三维方向图')
ax1.set_xlabel('X')
ax1.set_ylabel('Y')
ax1.set_zlabel('Z')
# ============ 子图2:E面和H面方向图 ============
ax2 = fig.add_subplot(2, 3, 2)
theta_2d = np.linspace(0, 2*np.pi, 360)
# E面(phi = 90°)
F_E = np.abs(np.sin(theta_2d))
# H面(theta = 90°)
F_H = np.ones_like(theta_2d) # 全向
ax2.polar(theta_2d, F_E, 'b-', linewidth=2, label='E面')
ax2.polar(theta_2d, F_H, 'r--', linewidth=2, label='H面')
ax2.set_title('电基本振子方向图')
ax2.legend(loc='upper right')
# ============ 子图3:半波振子方向图 ============
ax3 = fig.add_subplot(2, 3, 3)
# 半波振子方向性函数
F_halfwave = np.abs(np.cos(np.pi/2 * np.cos(theta_2d)) /
(np.sin(theta_2d) + 1e-10))
F_halfwave = np.clip(F_halfwave, 0, 1)
ax3.polar(theta_2d, F_halfwave, 'g-', linewidth=2)
ax3.set_title('半波振子方向图')
# ============ 子图4:不同长度振子的方向图 ============
ax4 = fig.add_subplot(2, 3, 4)
lengths = [0.25, 0.5, 0.75, 1.0] # 波长倍数
colors = ['blue', 'red', 'green', 'purple']
for L_lambda, color in zip(lengths, colors):
# 简化模型:正弦电流分布
if L_lambda <= 0.5:
F = np.abs(np.sin(theta_2d))
else:
# 长振子有更复杂的方向图
F = np.abs(np.sin(theta_2d) * np.cos(np.pi * L_lambda * np.cos(theta_2d)))
F = F / np.max(F)
ax4.polar(theta_2d, F, color=color, linewidth=1.5,
label=f'L={L_lambda}λ')
ax4.set_title('不同长度振子方向图')
ax4.legend(loc='upper right')
# ============ 子图5:小电流环方向图 ============
ax5 = fig.add_subplot(2, 3, 5, projection='3d')
# 小电流环方向图(与电基本振子正交)
F_loop = np.sin(Theta)
X_loop = F_loop * np.sin(Theta) * np.cos(Phi)
Y_loop = F_loop * np.sin(Theta) * np.sin(Phi)
Z_loop = F_loop * np.cos(Theta)
ax5.plot_surface(X_loop, Y_loop, Z_loop, cmap='viridis', alpha=0.7)
ax5.set_title('小电流环三维方向图')
ax5.set_xlabel('X')
ax5.set_ylabel('Y')
ax5.set_zlabel('Z')
# ============ 子图6:场强随距离变化 ============
ax6 = fig.add_subplot(2, 3, 6)
r_range = np.linspace(0.1, 10, 100)
theta = np.pi/2 # 最大辐射方向
I0 = 1.0
dl = ant.lambda_ / 20
# 近区场、过渡区、远区
E_near = []
E_far = []
for r in r_range:
kr = ant.k * r
if kr < 1:
# 近区
E = I0 * dl / (4 * np.pi) * (1/(ant.eta * r**3))
else:
# 远区
E = ant.eta * ant.k * I0 * dl / (4 * np.pi * r)
E_near.append(E)
# 纯远区公式
E_f = ant.eta * ant.k * I0 * dl / (4 * np.pi * r)
E_far.append(E_f)
ax6.semilogy(r_range, E_near, 'b-', linewidth=2, label='精确解')
ax6.semilogy(r_range, E_far, 'r--', linewidth=2, label='远区近似')
ax6.axvline(x=ant.lambda_/(2*np.pi), color='gray', linestyle=':',
label='近远场分界')
ax6.set_xlabel('距离 r (m)')
ax6.set_ylabel('|E| (V/m)')
ax6.set_title('场强随距离变化')
ax6.legend()
ax6.grid(True, alpha=0.3)
plt.tight_layout()
plt.savefig('basic_dipole_analysis.png', dpi=150, bbox_inches='tight')
plt.close()
return fig
def create_array_analysis():
"""创建天线阵列分析"""
fig, axes = plt.subplots(2, 3, figsize=(16, 10))
frequency = 1e9
ant = AntennaTheory(frequency)
# ============ 子图1:二元阵方向图 ============
ax1 = axes[0, 0]
theta = np.linspace(0, 2*np.pi, 360)
d = ant.lambda_ / 2 # 间距半波长
# 不同相位差的二元阵
betas = [0, np.pi/4, np.pi/2, np.pi]
colors = ['blue', 'red', 'green', 'purple']
for beta, color in zip(betas, colors):
AF = 2 * np.abs(np.cos(0.5 * (ant.k * d * np.cos(theta) + beta)))
AF = AF / np.max(AF)
ax1.polar(theta, AF, color=color, linewidth=1.5,
label=f'β={np.degrees(beta):.0f}°')
ax1.set_title('二元阵方向图 (d=λ/2)')
ax1.legend(loc='upper right')
# ============ 子图2:不同单元数的阵列 ============
ax2 = axes[0, 1]
N_values = [2, 4, 8, 16]
d = ant.lambda_ / 2
beta = 0 # 边射阵
for N in N_values:
AF = ant.array_factor(theta, N, d, beta)
AF = AF / np.max(AF)
ax2.polar(theta, AF, linewidth=1.5, label=f'N={N}')
ax2.set_title('不同单元数的阵列方向图')
ax2.legend(loc='upper right')
# ============ 子图3:波束扫描 ============
ax3 = axes[0, 2]
N = 8
d = ant.lambda_ / 2
scan_angles = [0, 30, 60, 90] # 扫描角度
for scan_angle in scan_angles:
theta_0 = np.radians(scan_angle)
beta = -ant.k * d * np.cos(theta_0)
AF = ant.array_factor(theta, N, d, beta)
AF = AF / np.max(AF)
ax3.polar(theta, AF, linewidth=1.5,
label=f'θ₀={scan_angle}°')
ax3.set_title('波束扫描 (N=8)')
ax3.legend(loc='upper right')
# ============ 子图4:单元间距的影响 ============
ax4 = axes[1, 0]
N = 6
d_values = [0.3, 0.5, 0.7, 1.0] # 波长倍数
beta = 0
for d_lambda in d_values:
d = d_lambda * ant.lambda_
AF = ant.array_factor(theta, N, d, beta)
AF = np.clip(AF / np.max(AF), 0, 1)
ax4.polar(theta, AF, linewidth=1.5,
label=f'd={d_lambda}λ')
ax4.set_title('单元间距的影响 (N=6)')
ax4.legend(loc='upper right')
# ============ 子图5:阵列增益与单元数关系 ============
ax5 = axes[1, 1]
N_range = np.arange(2, 33)
d = ant.lambda_ / 2
# 理论方向性系数(边射阵近似)
D_theory = 2 * N * d / ant.lambda_
D_theory = np.where(D_theory > N, N, D_theory)
ax5.plot(N_range, D_theory, 'b-', linewidth=2, label='理论方向性')
ax5.plot(N_range, N_range, 'r--', linewidth=2, label='D=N (上限)')
ax5.set_xlabel('单元数 N')
ax5.set_ylabel('方向性系数 D')
ax5.set_title('阵列方向性与单元数关系')
ax5.legend()
ax5.grid(True, alpha=0.3)
# ============ 子图6:二维阵列方向图 ============
ax6 = axes[1, 2]
# 8x8平面阵的简化方向图
theta_grid = np.linspace(0, np.pi, 100)
phi_grid = np.linspace(0, 2*np.pi, 100)
Theta, Phi = np.meshgrid(theta_grid, phi_grid)
# 简化模型:两个正交线阵的乘积
Nx, Ny = 8, 8
dx = dy = ant.lambda_ / 2
AF_x = np.sin(Nx * ant.k * dx * np.sin(Theta) * np.cos(Phi) / 2) / \
(np.sin(ant.k * dx * np.sin(Theta) * np.cos(Phi) / 2) + 1e-10)
AF_y = np.sin(Ny * ant.k * dy * np.sin(Theta) * np.sin(Phi) / 2) / \
(np.sin(ant.k * dy * np.sin(Theta) * np.sin(Phi) / 2) + 1e-10)
AF_2D = np.abs(AF_x * AF_y)
AF_2D = AF_2D / np.max(AF_2D)
# 绘制等高线
contour = ax6.contourf(np.degrees(Phi), np.degrees(Theta), AF_2D,
levels=20, cmap='jet')
plt.colorbar(contour, ax=ax6)
ax6.set_xlabel('方位角 φ (度)')
ax6.set_ylabel('极角 θ (度)')
ax6.set_title('8×8平面阵方向图')
plt.tight_layout()
plt.savefig('array_analysis.png', dpi=150, bbox_inches='tight')
plt.close()
return fig
def create_antenna_parameters():
"""创建天线参数分析"""
fig, axes = plt.subplots(2, 3, figsize=(16, 10))
frequency = 1e9
ant = AntennaTheory(frequency)
# ============ 子图1:辐射电阻与振子长度关系 ============
ax1 = axes[0, 0]
L_lambda = np.linspace(0.01, 1.0, 100)
# 电基本振子辐射电阻
Rr_short = 80 * np.pi**2 * (L_lambda)**2
# 半波振子近似
Rr_halfwave = np.where(np.abs(L_lambda - 0.5) < 0.05,
73.1, Rr_short)
ax1.plot(L_lambda, Rr_short, 'b-', linewidth=2, label='短振子近似')
ax1.axhline(y=73.1, color='r', linestyle='--',
label='半波振子 (73.1Ω)')
ax1.axvline(x=0.5, color='gray', linestyle=':', alpha=0.5)
ax1.set_xlabel('振子长度 L/λ')
ax1.set_ylabel('辐射电阻 Rr (Ω)')
ax1.set_title('辐射电阻与振子长度')
ax1.legend()
ax1.grid(True, alpha=0.3)
ax1.set_ylim(0, 200)
# ============ 子图2:方向性系数对比 ============
ax2 = axes[0, 1]
antenna_types = ['各向同性', '电基本振子', '半波振子', '单极子',
'5元边射阵', '8元边射阵']
D_linear = [1, 1.5, 1.64, 3.28, 5, 8]
D_dBi = [10 * np.log10(d) for d in D_linear]
colors = plt.cm.viridis(np.linspace(0, 1, len(antenna_types)))
bars = ax2.bar(antenna_types, D_dBi, color=colors)
ax2.set_ylabel('方向性系数 (dBi)')
ax2.set_title('不同天线的方向性系数')
ax2.tick_params(axis='x', rotation=45)
ax2.grid(True, alpha=0.3, axis='y')
# 添加数值标签
for bar, d in zip(bars, D_dBi):
height = bar.get_height()
ax2.text(bar.get_x() + bar.get_width()/2., height,
f'{d:.1f}', ha='center', va='bottom')
# ============ 子图3:HPBW与阵列单元数关系 ============
ax3 = axes[0, 2]
N_range = np.arange(2, 33)
d = ant.lambda_ / 2
# 边射阵HPBW近似公式
HPBW = 2 * np.arcsin(0.443 * ant.lambda_ / (N_range * d))
HPBW = np.degrees(HPBW)
ax3.plot(N_range, HPBW, 'b-', linewidth=2)
ax3.set_xlabel('单元数 N')
ax3.set_ylabel('HPBW (度)')
ax3.set_title('半功率波瓣宽度与单元数')
ax3.grid(True, alpha=0.3)
# ============ 子图4:极化特性 ============
ax4 = axes[1, 0]
# 线极化、圆极化、椭圆极化的电场矢量轨迹
t = np.linspace(0, 2*np.pi, 100)
# 线极化
Ex_linear = np.cos(t)
Ey_linear = np.zeros_like(t)
# 圆极化
Ex_circular = np.cos(t)
Ey_circular = np.sin(t)
# 椭圆极化 (轴比2:1)
Ex_elliptical = 2 * np.cos(t)
Ey_elliptical = np.sin(t)
ax4.plot(Ex_linear, Ey_linear, 'b-', linewidth=2, label='线极化')
ax4.plot(Ex_circular, Ey_circular, 'r-', linewidth=2, label='圆极化')
ax4.plot(Ex_elliptical, Ey_elliptical, 'g-', linewidth=2, label='椭圆极化')
ax4.set_xlabel('Ex')
ax4.set_ylabel('Ey')
ax4.set_title('极化类型')
ax4.legend()
ax4.grid(True, alpha=0.3)
ax4.set_aspect('equal')
# ============ 子图5:输入阻抗随频率变化 ============
ax5 = axes[1, 1]
# 半波振子输入阻抗随频率变化(简化模型)
f_center = 1e9
f_range = np.linspace(0.8e9, 1.2e9, 100)
# 归一化频率
f_norm = f_range / f_center
# 电阻部分(谐振附近)
R_in = 73.1 + 50 * (f_norm - 1)**2
# 电抗部分
X_in = 42.5 * (f_norm - 1) * 10 # 简化线性近似
ax5.plot(f_range/1e9, R_in, 'b-', linewidth=2, label='电阻 R')
ax5.plot(f_range/1e9, X_in, 'r--', linewidth=2, label='电抗 X')
ax5.axvline(x=1.0, color='gray', linestyle=':', alpha=0.5, label='谐振频率')
ax5.set_xlabel('频率 (GHz)')
ax5.set_ylabel('阻抗 (Ω)')
ax5.set_title('半波振子输入阻抗')
ax5.legend()
ax5.grid(True, alpha=0.3)
# ============ 子图6:VSWR与反射系数 ============
ax6 = axes[1, 2]
# 反射系数
Gamma = np.linspace(0, 1, 100)
# VSWR
VSWR = (1 + Gamma) / (1 - Gamma)
# 回波损耗
RL = -20 * np.log10(Gamma + 1e-10)
ax6.plot(Gamma, VSWR, 'b-', linewidth=2, label='VSWR')
ax6.axhline(y=2, color='r', linestyle='--', label='VSWR=2')
ax6.set_xlabel('|Γ|')
ax6.set_ylabel('VSWR')
ax6.set_title('VSWR与反射系数')
ax6.legend()
ax6.grid(True, alpha=0.3)
ax6.set_ylim(1, 10)
plt.tight_layout()
plt.savefig('antenna_parameters.png', dpi=150, bbox_inches='tight')
plt.close()
return fig
def create_practical_antennas():
"""创建实用天线分析"""
fig, axes = plt.subplots(2, 3, figsize=(16, 10))
frequency = 1e9
ant = AntennaTheory(frequency)
# ============ 子图1:八木天线方向图 ============
ax1 = axes[0, 0]
theta = np.linspace(0, 2*np.pi, 360)
# 简化八木天线模型(3单元)
# 有源振子 + 反射器 + 引向器
F_yagi = np.abs(np.sin(theta) * (1 + 0.8 * np.cos(np.pi * np.cos(theta)) +
0.6 * np.cos(np.pi * 0.85 * np.cos(theta))))
F_yagi = F_yagi / np.max(F_yagi)
ax1.polar(theta, F_yagi, 'b-', linewidth=2)
ax1.set_title('3单元八木天线方向图')
# 添加标注
ax1.text(0, 1.1, '前向', ha='center', fontsize=10)
ax1.text(np.pi, 0.3, '后向', ha='center', fontsize=10)
# ============ 子图2:抛物面天线增益 ============
ax2 = axes[0, 1]
# 不同直径的抛物面天线
D_diameters = np.linspace(0.5, 5, 50) # 米
eta = 0.6 # 孔径效率
Gains = eta * (np.pi * D_diameters / ant.lambda_)**2
Gains_dBi = 10 * np.log10(Gains)
ax2.plot(D_diameters, Gains_dBi, 'b-', linewidth=2)
# 标记一些典型值
for D in [1, 2, 3]:
G = 10 * np.log10(eta * (np.pi * D / ant.lambda_)**2)
ax2.plot(D, G, 'ro', markersize=8)
ax2.annotate(f'{G:.1f} dBi', xy=(D, G), xytext=(D+0.2, G+2))
ax2.set_xlabel('直径 D (m)')
ax2.set_ylabel('增益 (dBi)')
ax2.set_title('抛物面天线增益 (1GHz)')
ax2.grid(True, alpha=0.3)
# ============ 子图3:微带贴片天线 ============
ax3 = axes[0, 2]
# 矩形贴片简化方向图
theta_3d = np.linspace(0, np.pi, 50)
phi_3d = np.linspace(0, 2*np.pi, 100)
Theta, Phi = np.meshgrid(theta_3d, phi_3d)
# E面和H面方向图乘积
F_E = np.cos(np.pi/2 * np.sin(Theta) * np.cos(Phi))
F_H = np.cos(np.pi/2 * np.sin(Theta) * np.sin(Phi))
F_patch = np.abs(F_E * F_H)
F_patch = F_patch / np.max(F_patch)
# 转换为笛卡尔坐标绘制
X = F_patch * np.sin(Theta) * np.cos(Phi)
Y = F_patch * np.sin(Theta) * np.sin(Phi)
Z = F_patch * np.cos(Theta)
ax3 = fig.add_subplot(2, 3, 3, projection='3d')
ax3.plot_surface(X, Y, Z, cmap='viridis', alpha=0.7)
ax3.set_title('微带贴片天线方向图')
ax3.set_xlabel('X')
ax3.set_ylabel('Y')
ax3.set_zlabel('Z')
# ============ 子图4:螺旋天线(圆极化) ============
ax4 = axes[1, 0]
# 轴向模螺旋天线方向图(简化)
theta = np.linspace(0, 2*np.pi, 360)
# 主瓣在轴向(theta=0)
F_helical = np.abs(np.cos(theta/2)**8)
ax4.polar(theta, F_helical, 'b-', linewidth=2)
ax4.set_title('轴向模螺旋天线方向图')
# ============ 子图5:对数周期天线 ============
ax5 = axes[1, 1]
# 对数周期天线带宽演示
f_range = np.linspace(0.5e9, 2e9, 100)
# 增益随频率变化(简化)
Gain_lp = 7 + 2 * np.sin(2 * np.pi * f_range / 1e9)
ax5.plot(f_range/1e9, Gain_lp, 'b-', linewidth=2)
ax5.fill_between(f_range/1e9, 5, Gain_lp, alpha=0.3)
ax5.set_xlabel('频率 (GHz)')
ax5.set_ylabel('增益 (dBi)')
ax5.set_title('对数周期天线宽带特性')
ax5.grid(True, alpha=0.3)
# ============ 子图6:天线效率分析 ============
ax6 = axes[1, 2]
# 不同类型天线的效率对比
antenna_names = ['半波振子', '八木天线', '抛物面', '微带贴片', '螺旋天线']
efficiencies = [0.95, 0.85, 0.65, 0.70, 0.75]
colors = plt.cm.RdYlGn(np.array(efficiencies))
bars = ax6.barh(antenna_names, [e*100 for e in efficiencies], color=colors)
ax6.set_xlabel('效率 (%)')
ax6.set_title('不同类型天线的辐射效率')
ax6.set_xlim(0, 100)
ax6.grid(True, alpha=0.3, axis='x')
# 添加数值标签
for bar, eff in zip(bars, efficiencies):
width = bar.get_width()
ax6.text(width + 1, bar.get_y() + bar.get_height()/2.,
f'{eff*100:.0f}%', ha='left', va='center')
plt.tight_layout()
plt.savefig('practical_antennas.png', dpi=150, bbox_inches='tight')
plt.close()
return fig
def create_radiation_animation():
"""创建辐射动画"""
fig, axes = plt.subplots(1, 2, figsize=(14, 6))
frequency = 1e9
ant = AntennaTheory(frequency)
# 动画参数
n_frames = 60
def animate(frame):
axes[0].clear()
axes[1].clear()
time_phase = 2 * np.pi * frame / n_frames
# ========== 子图1:电基本振子瞬时场分布 ==========
theta = np.linspace(0, 2*np.pi, 360)
# 瞬时场(随时间变化)
E_instant = np.sin(theta) * np.cos(time_phase)
# 绘制
axes[0].polar(theta, np.abs(E_instant), 'b-', linewidth=2)
axes[0].set_title(f'电基本振子瞬时辐射场 (t={frame}/{n_frames})')
axes[0].set_ylim(0, 1.2)
# ========== 子图2:阵列波束扫描 ==========
N = 8
d = ant.lambda_ / 2
# 扫描角度随帧变化
scan_angle = 90 * np.sin(2 * np.pi * frame / n_frames)
theta_0 = np.radians(scan_angle)
beta = -ant.k * d * np.cos(theta_0)
AF = ant.array_factor(theta, N, d, beta)
AF = AF / np.max(AF)
axes[1].polar(theta, AF, 'r-', linewidth=2)
axes[1].set_title(f'阵列波束扫描 (θ₀={scan_angle:.0f}°)')
axes[1].set_ylim(0, 1.2)
return []
anim = animation.FuncAnimation(fig, animate, frames=n_frames,
interval=200, blit=False)
anim.save('antenna_radiation_animation.gif', writer='pillow', fps=5, dpi=100)
plt.close()
return anim
# 主程序
if __name__ == '__main__':
print("="*60)
print("天线基础理论与辐射特性仿真")
print("="*60)
# 1. 基本振子分析
print("\n[1/5] 生成基本振子分析...")
create_basic_dipole_analysis()
print(" 已保存: basic_dipole_analysis.png")
# 2. 阵列分析
print("\n[2/5] 生成天线阵列分析...")
create_array_analysis()
print(" 已保存: array_analysis.png")
# 3. 天线参数
print("\n[3/5] 生成天线参数分析...")
create_antenna_parameters()
print(" 已保存: antenna_parameters.png")
# 4. 实用天线
print("\n[4/5] 生成实用天线分析...")
create_practical_antennas()
print(" 已保存: practical_antennas.png")
# 5. 动画
print("\n[5/5] 生成辐射动画...")
create_radiation_animation()
print(" 已保存: antenna_radiation_animation.gif")
print("\n" + "="*60)
print("所有仿真完成!")
print("="*60)
AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。
更多推荐



所有评论(0)