本帖最后由 840A 于 2024-8-22 12:41 编辑
补:单管
s参数:
计算步骤相同.
matlab单管
clear all;
clc;
syms rf rb re rbe ro rc gm I1 I2
R0=50
M=[1,0;0,1]
VA=50
VT=26e-3
IC=10e-3
beta0=150
gm=IC/VT
ro=VA/IC
rbe=beta0/gm
rc=330
Y11=1/rb+1/rbe+1/rf
Y12=-1/rf
Y13=-1/rbe
Y21=-1/rf+gm
Y22=1/rf+1/ro+1/rc
Y23=-1/ro-gm
Y31=-1/rbe-gm
Y32=-1/ro
Y33=1/rbe+1/re+1/ro+gm
Y=[Y11,Y12,Y13;Y21,Y22,Y23;Y31,Y32,Y33]
I=[I1;I2;0]
U=inv(Y)*I
Z=[diff(U(1),I1),diff(U(1),I2);diff(U(2),I1),diff(U(2),I2)]
S=inv(Z+R0*M)*(Z-R0*M);
python:穷举电阻_单管
import math
import itertools
def generate_E_set(a='E6',minmax=[0,1]):
E24_T=[1.0,1.1,1.2,1.3,1.5,1.6,1.8,2,2.2,2.4,2.7,3,3.3,3.6,3.9,4.3,4.7,5.1,5.6,6.2,6.8,7.5,8.2,9.1]
E6_T=[1.0,1.5,2.2,3.3,4.7,6.8]
E12_T=[1.0,1.5,2.2,3.3,4.7,6.8]
_E_ALL=[]
if(a=='E6'):
_E_T=E6_T
elif(a=='E12'):
_E_T=E12_T
elif(a=='E24'):
_E_T=E24_T
else:
return []
for i in range(minmax[0],minmax[1]):
for v in _E_T:
_E_ALL.append(v*math.pow(10,i))
return _E_ALL
def get_s11(rf,re,rb):
return -(1888475000.0*re + 103350000.0*rf + rb*(1888475.0*re - 1802000.0*rf - 793157.0*re*rf + 1893350000.0) + 39660475.0*re*rf + 4875000000.0)/(1888475000.0*re + 103350000.0*rf + 39660475.0*re*rf + rb*(77427475.0*re + 2332000.0*rf + 793262.0*re*rf + 2088350000.0) + 4875000000.0)
def get_s22(rf,re,rb):
return -(1888475000.0*re - 91650000.0*rf + rb*(1888475.0*re - 2068000.0*rf - 717618.0*re*rf + 1893350000.0) - 35878525.0*re*rf + 4875000000.0)/(1888475000.0*re + 103350000.0*rf + 39660475.0*re*rf + rb*(77427475.0*re + 2332000.0*rf + 793262.0*re*rf + 2088350000.0) + 4875000000.0)
def get_s21(rf,re,rb):
return (100.0*rb*(755390.0*re - 750000.0*rf + re*rf + 1950000.0))/(2088350000.0*rb + 1888475000.0*re + 103350000.0*rf + 77427475.0*rb*re + 2332000.0*rb*rf + 39660475.0*re*rf + 793262.0*rb*re*rf + 4875000000.0)
def show(comb):
rf=combination[0]
re=combination[1]
rb=combination[2]
print("rf=%.0f,re=%.1f,rb=%.0f,s11=%.3f,s22=%.3f,s21=%.3f" % (rf,re,rf,get_s11(rf,re,rb),get_s22(rf,re,rb),get_s21(rf,re,rb)))
# 子收敛函数
def good_enough_approach(x,ref):
return ((abs(x-ref)/ref)<ERROR_MAX)
def good_enough_less(x,ref):
return abs(x)<ref
def good_enough_great(x,ref):
return abs(x)>ref
# 总收敛函数
def set_is_good_enough(comb):
rf=combination[0]
re=combination[1]
rb=combination[2]
s11=get_s11(rf,re,rb)
s21=get_s21(rf,re,rb)
s22=get_s22(rf,re,rb)
return good_enough_less(s11,0.05) and good_enough_less(s22,0.05) and good_enough_great(s21,4.0)
E_RF=generate_E_set('E6',[2,3])
E_RE=generate_E_set('E6',[0,1])
E_RB=generate_E_set('E6',[2,4])
# 穷举
for combination in itertools.product(E_RF,E_RE,E_RB):
if(set_is_good_enough(combination)):
show(combination)
用的E6电阻,考虑到模型的精度,E24,还是到实践环节解决吧。E6电阻搜索结果
rf=330,re=4.7,rb=330,s11=-0.041,s22=-0.008,s21=-5.305
rf=330,re=4.7,rb=330,s11=-0.033,s22=-0.013,s21=-5.348
rf=330,re=4.7,rb=330,s11=-0.028,s22=-0.016,s21=-5.375
rf=330,re=4.7,rb=330,s11=-0.025,s22=-0.019,s21=-5.395
rf=330,re=4.7,rb=330,s11=-0.022,s22=-0.020,s21=-5.407
rf=330,re=4.7,rb=330,s11=-0.021,s22=-0.022,s21=-5.416
rf=470,re=3.3,rb=470,s11=0.026,s22=0.048,s21=-7.366
rf=470,re=3.3,rb=470,s11=0.030,s22=0.045,s21=-7.394
rf=470,re=3.3,rb=470,s11=0.032,s22=0.043,s21=-7.412
rf=470,re=3.3,rb=470,s11=0.034,s22=0.042,s21=-7.424
rf=680,re=1.0,rb=680,s11=-0.046,s22=0.012,s21=-11.634
rf=680,re=1.0,rb=680,s11=-0.041,s22=0.008,s21=-11.694
rf=680,re=1.0,rb=680,s11=-0.037,s22=0.005,s21=-11.736
rf=680,re=1.0,rb=680,s11=-0.035,s22=0.004,s21=-11.762
rf=680,re=1.0,rb=680,s11=-0.034,s22=0.002,s21=-11.780
|