我的新博客

微带线分析与综合

本文实现的计算精度可媲美ADS等 专业 电磁计算软件,matlab实现

github地址:https://github.com/yangli0534/microstrip_calc

  1 function ms = ms_analysis(substrate, w, l,fc)
  2 % MS_ANALYSIS calc electric specification of microstrip line 
  3 % Author : LEON, yangli0534@yahoo.com
  4 % blog : www.cnblogs.com/hiramlee0534
  5 % parameters : 
  6 % substrate is a struct ,('er',varepsilon_r,'h',h,'mur',mu_r, 't',t, 'cond', cond, 'rough',0,'tand',tanD);
  7 % w , width of ms
  8 % l , length of ms
  9 % fc, frequency
 10 % ms was a struct, ms = struct('Zc',ms_Zc, 'er_eff',ms_ereff, 'El',ms_el,'beta',ms_beta, 'loss',loss, 'delay',delay, 'delta',skin_depth);
 11 % Zc: charateristic impdance
 12 % er_eff: effective relative permitivity
 13 % El : electric length
 14 % 
 15 %%
 16 % constant
 17 varepsilon_0  = 8.854187817e-12;
 18 mu0 = 4*pi*1e-7;
 19 c = 1/sqrt(varepsilon_0*mu0);
 20 
 21 %%
 22 %electric parameters
 23 %Zc = 50 ;% characteristic impedance.
 24 %El = 90;%
 25 %fc = 35e9; %center frequency :Hz
 26 %%
 27 % substate parameters
 28 ms_er = substrate.er;%2.2 ; % relative permittivity constant
 29 ms_h = substrate.h/1e3;%0.508e-3; % substrate height:m
 30 ms_t = substrate.t/1e3;%;0;%metal thickness :m
 31 mur = substrate.mur;%1; % ralative permeability constant
 32 rough = substrate.rough;%T0 ; %
 33 cond = substrate.cond;%5.88e7; % conductivity
 34 ms_tand = substrate.tand;
 35 %substrate = struct('er',2.2,'h',0.508,'t',0.1,'tand',0.0009,'cond',5.8e7,'rought',0)
 36 mu = mur*4*pi*1.0e-7;%   permeability
 37 %t = float(lineEdit_ms_T.text())/1.0e3
 38 %%
 39 %freq
 40 lambda0 = c/fc;% % wavelengt in free space : m
 41 ms_fc = fc;
 42 ms_w = w/1e3;
 43 ms_l = l/1e3;
 44 %%
 45 %calc
 46 U = ms_w/ms_h; % ratio of trace width to substrate thickness
 47 if ms_t > 0
 48     T = ms_t/ms_h; %ratio of conductor thickness to substrate thickness
 49     %(T/PI)*log(1.0 + 4.0*exp(1.0)/(T*power(coth(sqrt(6.517*u)),2.0)))
 50     U1 = U +(T*log(1.0+4.0*exp(1)/T/power(1.0/tanh(sqrt(6.517*U)),2.0)))/pi; % from Hammerstad and Jensen
 51     %   0.5*(1.0 + 1.0/cosh(sqrt(er-1.0)))*deltau1
 52     Ur = U +(U1-U)*(1.0+1.0/(cosh(sqrt(ms_er-1))))/2.0; % from Hammerstad and Jensen
 53 else
 54     U1 = U;
 55     Ur = U;
 56 end
 57 Y = ee_HandJ(Ur,ms_er);
 58 %        %Z0 =z0_HandJ(Ur)/sqrt(Y)
 59 %ereff0 = Y*power(Z01_U1/Z01_Ur,2)
 60 ereff0 = Y*power(z0_HandJ(U1)/z0_HandJ(Ur),2.0);
 61 
 62 fn = ms_fc*ms_h/1e7;
 63 P1 = 0.27488 + (0.6315 + (0.525 / (power((1 + 0.157*fn),20))) )*U - 0.065683*exp(-8.7513*U);
 64 P2 = 0.33622*(1 - exp(-0.03442*ms_er));
 65 P3 = 0.0363*exp(-4.6*U)*(1 - exp(-power((fn / 3.87),4.97)));
 66 P4 = 1 + 2.751*( 1 -  exp(-power((ms_er/15.916),8)));
 67 P = P1*P2*power(((0.1844 + P3*P4)*10*fn),1.5763);
 68 ms_ereff = (ms_er*P+ereff0)/(1+P); % equavlent ralative dielectric constant
 69 ms_Zc = microstrip_z_calc(ms_w,ms_h,ms_l,ms_t,ms_fc,ms_er);
 70 z1 = 0.434907*((power(ms_ereff,0.81) + 0.26)/(power(ms_ereff,0.81) - 0.189))*(power(U,0.8544) + 0.236)/(power(U,0.8544) + 0.87);
 71 z2 = 1 + (power(U,0.371))/(2.358*ms_er + 1);
 72 z3 = 1 + (0.5274*atan(0.084*(power(U,(1.9413 / z2)))))/(power(ms_ereff,0.9236));
 73 z4 = 1 + 0.0377*atan(0.067*(power(U,1.456)))*(6 - 5*exp(0.036*(1-ms_er)));
 74 z5 = 1 - 0.218*exp(-7.5*U);
 75 deltal = ms_h * z1 * z3 * z5 / z4;
 76 v = c/sqrt(ms_ereff);
 77 length = ms_l/(v/ms_fc);
 78 % delay
 79 delay = 1e9*ms_l/v;
 80 % dielectric losses
 81 ld = pi*ms_fc/v*ms_er/ms_ereff*(ms_ereff-1)/(ms_er-1)*ms_tand ;% unit in nepers/meter
 82 ld = 20.0/log(10)*ld ;% unit in dB/meter
 83 ld = ld * ms_l; % unit in dB
 84 % conduction losses
 85 % skin depth in meters
 86 skin_depth = sqrt(1/(pi*ms_fc*mu*cond));
 87 if skin_depth <= ms_t
 88     Z2 = microstrip_z_calc(ms_w,ms_h,ms_l,ms_t,ms_fc,1);
 89     Z1 = microstrip_z_calc(ms_w-skin_depth,ms_h+skin_depth,ms_l,ms_t-skin_depth,ms_fc,1);
 90     % conduction losser
 91     lc = pi*ms_fc/c*(Z1-Z2)/ms_Zc;
 92 elseif ms_t > 0
 93     %resistance per meter = 1/(Area*conductivity)
 94     res = 1/(ms_w*ms_t*cond);
 95     %conduction losses, nepers per meter
 96     lc = res/(2.0*ms_Zc);
 97     skin_depth = ms_t;
 98 else
 99     lc = 0;
100 end
101 lc = 20.0/log(10)*lc;
102 lc = lc * ms_l;
103 lc = lc * (1.0+2.0/pi*atan(1.4*power(rough/skin_depth,2)));
104 loss = ld + lc;
105 ms_k0 = 2*pi/c*ms_fc;
106 ms_beta = ms_k0*sqrt(ms_ereff);
107 ms_el = sqrt(ms_ereff)*ms_k0*ms_l/1000/pi*180.0;
108 ms_el = 360*length;
109 %         lineEdit_ms_Zc.setText(str(ms_Zc))
110 %         lineEdit_ms_ereff.setText(str(ms_ereff))
111 %         lineEdit_ms_el.setText(str(ms_el))
112 %         lineEdit_ms_beta.setText(str(ms_beta))
113 %         lineEdit_ms_loss.setText(str(loss))
114 %         label_delay.setText('delay = '+str(delay)+' ns')
115 %         label_skin_depth.setText('skin depth = '+str(skin_depth)+' m')
116 ms = struct('Zc',ms_Zc, 'er_eff',ms_ereff, 'El',ms_el,'beta',ms_beta, 'loss',loss, 'delay',delay, 'delta',skin_depth);
117 end

 

  1 function  ms = ms_synthesis(substrate,Zc,El,fc)
  2 % MS_SYSTHESIS calc the width and length of microstrip line 
  3 % Author : LEON, yangli0534@yahoo.com
  4 % blog : www.cnblogs.com/hiramlee0534
  5 % parameters : 
  6 % substrate is a struct ,('er',varepsilon_r,'h',h,'mur',mu_r, 't',t, 'cond', cond, 'rough',0,'tand',tanD);
  7 % Zc ,characteristic impedance
  8 % El : electric length
  9 % fc : frequency Hz
 10 % output variable ms is a struct,('w',wx*1e3, 'l',l*1e3,'er_eff',er_eff);
 11 % the unit for length is mm
 12 % Example
 13 %Zc = 50;
 14 %El = 90;
 15 %f0=35e9;
 16 %substrate = struct('er',varepsilon_r,'h',h,'mur',mu_r, 't',t, 'cond', cond, 'rough',0,'tand',tanD);
 17 %
 18 %ms=ms_synthesis(substrate,Zc,El,f0)
 19 %the output result:
 20 %ms = 
 21 %
 22 %  struct with fields:
 23 %
 24 %         w: 1.543090255176611
 25 %         l: 1.800407506983852
 26 %    er_eff: 1.925472337115954
 27 %%
 28 % constant
 29 varepsilon_0  = 8.854187817e-12;
 30 mu0 = 4*pi*1e-7;
 31 c = 1/sqrt(varepsilon_0*mu0);
 32 
 33 %%
 34 %electric parameters
 35 %Zc = 50 ;% characteristic impedance.
 36 %El = 90;%
 37 %fc = 35e9; %center frequency :Hz
 38 %%
 39 % substate parameters
 40 er = substrate.er;%2.2 ; % relative permittivity constant
 41 h = substrate.h/1e3;%0.508e-3; % substrate height:m
 42 t = substrate.t/1e3;%;0;%metal thickness :m
 43 mur = substrate.mur;%1; % ralative permeability constant
 44 rough = substrate.rough;%T0 ; %
 45 cond = substrate.cond;%5.88e7; % conductivity
 46 %substrate = struct('er',2.2,'h',0.508,'t',0.1,'tand',0.0009,'cond',5.8e7,'rought',0)
 47 mu = mur*4*pi*1.0e-7;%   permeability
 48 %t = float(lineEdit_ms_T.text())/1.0e3
 49 
 50 lambda0 = c/fc;% % wavelengt in free space : m
 51 lx = 1000*25.4e-6;
 52 wmin = 0.01*25.4e-6;
 53 wmax = 499.0*25.4e-6;
 54 %impedance convergence tolerance (ohms)
 55 abstol = 1e-6;
 56 reltol = 0.1e-6;
 57 maxiters = 50;
 58 A = ((er - 1)/(er + 1)) * (0.226 + 0.121/er) + (pi/377.0)*sqrt(2*(er+1))*Zc;
 59 w_h = 4/(0.5*exp(A) - exp(-A));
 60 if w_h > 2.0
 61     B = pi*377.0/(2*Zc*sqrt(er));
 62     w_h = (2/pi)*(B - 1 - log(2*B - 1) + ((er-1)/(2*er))*(log(B-1) + 0.293 - 0.517/er));
 63 end
 64 wx = h * w_h;
 65 
 66 if wx >= wmax
 67     wx = 0.95*wmax;
 68 end
 69 
 70 if wx <= wmin
 71     wx = wmin;
 72 end
 73 wold = 1.01*wx;
 74 Zold =  microstrip_z_calc(wold,h,lx,t,fc,er);
 75 
 76 
 77 if Zold < Zc
 78     wmax = wold;
 79 else
 80     wmin = wold;
 81 end
 82 
 83 iters = 0;
 84 done = 0;
 85 
 86 while done == 0
 87     iters = iters + 1;
 88     Z0 = microstrip_z_calc(wx,h,lx,t,fc,er);
 89     if Z0 < Zc
 90         wmax = wx;
 91     else
 92         wmin = wx;
 93     end
 94     if abs(Z0-Zc) < abstol
 95         done = 1;
 96     elseif abs(wx-wold) < reltol
 97         done = 1;
 98     elseif iters >= maxiters
 99         done = 1;
100     else
101         dzdw = (Z0 -Zold)/(wx-wold);
102         wold = wx;
103         Zold = Z0;
104         wx = wx -(Z0-Zc)/dzdw;
105         if (wx > wmax) || (wx < wmin)
106             wx = (wmin+ wmax)/2.0;
107         end
108     end
109 end
110 
111 er_eff = er_eff_calc(wx,h,t,fc,er);
112 v =  c/sqrt(er_eff);
113 l = El/360.0*v/fc;
114 %num2str(wx*1.0e3)
115 %num2str(er_eff)
116 %num2str(l*1.0e3)
117 ms = struct('w',wx*1e3, 'l',l*1e3,'er_eff',er_eff);
118 end
 1 function Zc = microstrip_z_calc(w,h,l,t,fc,er)
 2 
 3 U = w/h; % ratio of trace width to substrate thickness
 4 if t > 0
 5     T = t/h; %ratio of conductor thickness to substrate thickness
 6     %(T/PI)*log(1.0 + 4.0*exp(1.0)/(T*power(coth(sqrt(6.517*u)),2.0)))
 7     U1 = U +(T*log(1.0+4.0*exp(1)/T/power(1.0/tanh(sqrt(6.517*U)),2.0)))/pi; % from Hammerstad and Jensen
 8     %   0.5*(1.0 + 1.0/cosh(sqrt(er-1.0)))*deltau1
 9     Ur = U +(U1-U)*(1.0+1.0/(cosh(sqrt(er-1))))/2.0; % from Hammerstad and Jensen
10 else
11     U1 = U;
12     Ur = U;
13 end
14 Y = ee_HandJ(Ur,er);
15 Z0 =z0_HandJ(Ur)/sqrt(Y);
16 %ereff0 = Y*power(Z01_U1/Z01_Ur,2)
17 ereff0 = Y*power(z0_HandJ(U1)/z0_HandJ(Ur),2.0);
18 fn = fc*h/1e7;
19 P1 = 0.27488 + (0.6315 + (0.525 / (power((1 + 0.157*fn),20))) )*U - 0.065683*exp(-8.7513*U);
20 P2 = 0.33622*(1 - exp(-0.03442*er));
21 P3 = 0.0363*exp(-4.6*U)*(1 - exp(-power((fn / 3.87),4.97)));
22 P4 = 1 + 2.751*( 1 -  exp(-power((er/15.916),8)));
23 P = P1*P2*power(((0.1844 + P3*P4)*10*fn),1.5763);
24 ereff = (er*P+ereff0)/(1+P); % equavlent ralative dielectric constant
25 %ms_Zc = Z0*power(ereff0/ms_ereff,0.5)*(ms_ereff-1)/(ereff0-1)
26 fn = fc*h/1e6;
27 R1 = 0.03891*(power(er,1.4));
28 R2 = 0.267*(power(U,7.0));
29 R3 = 4.766*exp(-3.228*(power(U,0.641)));
30 R4 = 0.016 + power((0.0514*er),4.524);
31 R5 = power((fn/28.843),12.0);
32 R6 = 22.20*(power(U,1.92));
33 R7 = 1.206 - 0.3144*exp(-R1)*(1 - exp(-R2));
34 R8 = 1.0 + 1.275*(1.0 -  exp(-0.004625*R3*power(er,1.674)*power(fn/18.365,2.745)));
35 R9 = (5.086*R4*R5/(0.3838 + 0.386*R4))*(exp(-R6)/(1 + 1.2992*R5));
36 R9 = R9 * (power((er-1),6))/(1 + 10*power((er-1),6));
37 R10 = 0.00044*(power(er,2.136)) + 0.0184;
38 R11 = (power((fn/19.47),6))/(1 + 0.0962*(power((fn/19.47),6)));
39 R12 = 1 / (1 + 0.00245*U*U);
40 R13 = 0.9408*(power( ereff,R8)) - 0.9603;
41 R14 = (0.9408 - R9)*(power(ereff0,R8))-0.9603;
42 R15 = 0.707*R10*(power((fn/12.3),1.097));
43 R16 = 1 + 0.0503*er*er*R11*(1 - exp(-(power((U/15),6))));
44 R17 = R7*(1 - 1.1241*(R12/R16)*exp(-0.026*(power(fn,1.15656))-R15));
45 Zc = Z0*(power((R13/R14),R17));% characteristic impedance
46 end

 

posted @ 2017-07-19 23:59  Leon#0534  阅读(876)  评论(0编辑  收藏  举报

我的新博客

专注天线学习,欢迎交流 yangli0534@gmail.com - 创建于 2010年

我永远是茫茫EE领域的一名小学生。