Professional Documents
Culture Documents
How To Solve Microwave Engineering Pozar 05 Exercise 03 With MATLAB
How To Solve Microwave Engineering Pozar 05 Exercise 03 With MATLAB
5.3
single shunt open circuit stub with transmission line, both stub and
transmission line with Z0=75, to match ZL=100+1j*80.
There are 2 solutions, towards generator, CW, along SWR circle, until
real(Zin)==Z0
pozar_05_exercise_03.m
Z0=75; ZL=100+1j*80;
gamma_ZL=(ZL-Z0)/(ZL+Z0);
hf(1)=figure(1);sm(1)=smithchart; ax(1)=hf(1).CurrentAxes;
hold(ax(1),'on')
plot(ax(1),real(gamma_ZL),imag(gamma_ZL),'o','Color',[1 0 0]) % ZL
YL=1/ZL
gamma_YL=-gamma_ZL
gamma_YL_angle=angle(gamma_YL);gamma_YL_mod=abs(gamma_YL)
if gamma_YL_angle<0 gamma_YL_angle=2*pi+gamma_YL_angle; end
if gamma_YL_angle>(2*pi) gamma_YL_angle=gamma_YL_angle-2*pi;
end
Smith_plotY(ax(1),YL,1/Z0)
Smith_plotRefLine2PhaseCircle(ax(1),YL,1/Z0,[.6 1 .6])
[x_swr,y_swr]=Smith_plotGammaCircle(ax(1),ZL,Z0,[1 .6 .6])
[g1x,g1y]=pol2cart(gamma_YL_angle,gamma_YL_mod)
[xr1,yr1]=Smith_plotRcircle(ax(1),Z0,Z0,[0 0 1])
[xint,yint]=intersections(x_swr,y_swr,xr1,yr1,1);
plot(ax(1),xint,yint,'go')
gb1=xint(1)+1j*yint(1);
gb1_angle=angle(gb1);gb1_mod=abs(gb1)
if gb1_angle<0 gb1_angle=2*pi+gb1_angle; end
if gb1_angle>(2*pi) gb1_angle=gb1_angle-2*pi; end
checking stub already on r=1 circle
Yb_1=(1/Z0*(1-gb1)/(1+gb1)) %^-1
1/Yb_1 % check real(Z) spot on r=1 circle 1/Yb_1 = 75.009858443284173 -
72.565629355776338i
Smith_plotRefLine2PhaseCircle(ax(1),1/Yb_1,Z0,[.6 1 .6])
% on Smith chart
isequal(Yb_1,gamma2z(-gb1,1/Z0)) =
logical
da=1/1000;arc1=da
1
a0=gamma_YL_angle;a1=gb1_angle;gamma_mod=gamma_YL_mod
D1_TL_lambda=arc1/(4*pi) D1_TL_lambda =
while abs(a0-a1)>da
0.405924682355882
a0=a0-da;arc1=arc1+da;
if a0<0 a0=2*pi+a0; end % avoid negative angle
D1_TL_angle_deg=D1_TL_lambda*180/.5 D1_TL_angle_deg =
if a0>(2*pi) a0=a0-2*pi; end
1.461328856481175e+02
gamma=gamma_mod*(cos(a0)+1j*sin(a0));
plot(ax(1),real(gamma),imag(gamma),'ro','LineWidth',1.5);
% drawnow
end
plot(ax(1),xint,yint,'go')
D1_TL_lambda=arc1/(4*pi)
D1_TL_angle_deg=D1_TL_lambda*180/.5
% lambda/2 is 180º electric length that is 360º on Smith Chart
________________________________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com attached: -- pozar_05_exercisee_03.m 1 / 10
MICROWAVE ENGINEERING – POZAR – IMPEDANCE MATCHING CHAPTER 05 EXERCISE 03 10/09/2018 23:19:02.
electric length in fractions of wavelength electric length in degree arc angle on Smith Chart
hf(2)=figure(2);sm(2)=smithchart; ax(2)=hf(2).CurrentAxes;
hold(ax(2),'on')
plot(ax(2),real(gamma_ZL),imag(gamma_ZL),'o','Color',[1 0 0]) % ZL
gamma_YL_angle=angle(gamma_YL);gamma_YL_mod=abs(gamma_YL)
if gamma_YL_angle<0 gamma_YL_angle=2*pi+gamma_YL_angle; end
if gamma_YL_angle>(2*pi) gamma_YL_angle=gamma_YL_angle-2*pi;
end
Smith_plotY(ax(2),YL,1/Z0)
Smith_plotRefLine2PhaseCircle(ax(2),YL,1/Z0,[.2 .8 .2])
[x_swr,y_swr]=Smith_plotGammaCircle(ax(2),ZL,Z0,[.8 .2 .2])
[g1x,g1y]=pol2cart(gamma_YL_angle,gamma_YL_mod)
[xr1,yr1]=Smith_plotRcircle(ax(2),Z0,Z0,[0 0 1])
[xint,yint]=intersections(x_swr,y_swr,xr1,yr1,1);
plot(ax(2),xint,yint,'go')
gb2=xint(2)+1j*yint(2);
gb2_angle=angle(gb2);gb2_mod=abs(gb2)
if gb2_angle<0 gb2_angle=2*pi+gb2_angle; end 1/Yb_2 1/Yb_2 =
if gb2_angle>(2*pi) gb2_angle=gb2_angle-2*pi; end 75.009858443284173
+72.565629355776380i
Yb_2=(1/Z0*(1-gb2)/(1+gb2)) %^-1 isequal(Yb_2,gamma2z(-gb2,1/Z0)) = 1
1/Yb_2 % check real(Z) spot on r=1 circle
D2_TL_lambda=arc2/(4*pi) D2_TL_lambda =
Smith_plotRefLine2PhaseCircle(ax(2),1/Yb_2,Z0,[.2 .8 .2]) D2_TL_angle_rad=arc2/2 0.228387343336868
D2_TL_angle_deg=arc2*90/pi D2_TL_angle_rad =
da=1/1000;arc2=da 1.434999999999
a0=gamma_YL_angle;a1=gb2_angle;gamma_mod=gamma_YL_mod D2_TL_angle_deg =
while abs(a0-a1)>da 82.219443601272644
a0=a0-da;arc2=arc2+da;
if a0<0 a0=2*pi+a0; end % avoid negative angle
if a0>(2*pi) a0=a0-2*pi; end
gamma=gamma_mod*(cos(a0)+1j*sin(a0));
plot(ax(2),real(gamma),imag(gamma),'ro','LineWidth',1.5);
% drawnow
end
plot(ax(2),xint,yint,'go')
isequal(Yb_2,gamma2z(-gb2,1/Z0)) =
logical
1
________________________________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com attached: -- pozar_05_exercisee_03.m 2 / 10
MICROWAVE ENGINEERING – POZAR – IMPEDANCE MATCHING CHAPTER 05 EXERCISE 03 10/09/2018 23:19:02.
plot(ax(3),real(gamma_ZL),imag(gamma_ZL),'o','Color',[1 0 0])
gamma_YL_angle=angle(gamma_YL);gamma_YL_mod=abs(gamma_YL)
if gamma_YL_angle<0 gamma_YL_angle=2*pi+gamma_YL_angle; end
if gamma_YL_angle>(2*pi) gamma_YL_angle=gamma_YL_angle-2*pi; end
Smith_plotY(ax(3),YL,1/Z0)
Smith_plotRefLine2PhaseCircle(ax(3),YL,1/Z0,[.2 .6 .2])
[x_swr,y_swr]=Smith_plotGammaCircle(ax(3),ZL,Z0,[1 .6 .6])
[g1x,g1y]=pol2cart(gamma_YL_angle,gamma_YL_mod)
[xr1,yr1]=Smith_plotRcircle(ax(3),Z0,Z0,[0 0 1])
[xint,yint]=intersections(x_swr,y_swr,xr1,yr1,1);
plot(ax(3),xint,yint,'go')
gb1=xint(1)+1j*yint(1);gb1_angle=angle(gb1);gb1_mod=abs(gb1)
if gb1_angle<0 gb1_angle=2*pi+gb1_angle; end
if gb1_angle>(2*pi) gb1_angle=gb1_angle-2*pi; end
yb_1=1/Z0*((1+gb1)/(1-gb1))^-1
1/yb_1 % check already on r=1
Smith_plotRefLine2PhaseCircle(ax(3),1/yb_1,Z0,[.2 .8 .2]) % 1st intersection
Zbs2=1j*imag(Zbs)
refl_Zstub=(Z0-Zbs2)/(Z0+Zbs2)
refl_Ystub=-refl_Zstub % where stub Zin has to be
plot(ax(3),real(refl_Ystub),imag(refl_Ystub),'ro')
Smith_plotRefLine2PhaseCircle(ax(3),Zbs2,Z0,[.2 .2 .8])
Smith_plotBarc(ax(3),Zbs,Z0,[1 0 1])
da=1/100;a_stub=[angle(refl_Ystub):da:pi];arc_stub1=da;
for k=1:1:numel(a_stub)
gamma_stub=cos(a_stub)+1j*sin(a_stub);
arc_stub1=arc_stub1+da;
plot(ax(3),real(gamma_stub),imag(gamma_stub),'bo','LineWidth',1.5);
end
arc_stub1=arc_stub1-da;
http://i63.tinypic.com/2l9sb6a.jpg
arc_stub1*180/pi
arc_stub1_lambda=.25/pi*arc_stub1 arc_stub1_lambda = 0.122549306180760
same as
________________________________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com attached: -- pozar_05_exercisee_03.m 3 / 10
MICROWAVE ENGINEERING – POZAR – IMPEDANCE MATCHING CHAPTER 05 EXERCISE 03 10/09/2018 23:19:02.
% calculating stub lenght Dstub2
hf(4)=figure(4);sm(4)=smithchart; ax(4)=hf(4).CurrentAxes;hold(ax(4),'on');
plot(ax(4),real(gamma_ZL),imag(gamma_ZL),'o','Color',[1 0 0])
Smith_plotY(ax(4),YL,1/Z0)
Smith_plotRefLine2PhaseCircle(ax(4),YL,1/Z0,[.2 .6 .2])
[x_swr,y_swr]=Smith_plotGammaCircle(ax(4),ZL,Z0,[1 .6 .6])
[g1x,g1y]=pol2cart(gamma_YL_angle,gamma_YL_mod)
[xr1,yr1]=Smith_plotRcircle(ax(4),Z0,Z0,[0 0 1])
[xint,yint]=intersections(x_swr,y_swr,xr1,yr1,1);
plot(ax(4),xint,yint,'go')
gb2=xint(2)+1j*yint(2);gb2_angle=angle(gb2);gb2_mod=abs(gb2)
if gb2_angle<0 gb2_angle=2*pi+gb2_angle; end
if gb2_angle>(2*pi) gb2_angle=gb2_angle-2*pi; end
Yb_2=1/Z0*((1+gb2)/(1-gb2)) ^-1
1/Yb_2 % check already on r=1
Smith_plotRefLine2PhaseCircle(ax(4),1/Yb_2,Z0,[.2 .8 .2])
gstub=conj(gb2)
plot(ax(4),real(gstub),imag(gstub),'bo')
Zbs=(1/Z0*(1-gstub)/(1+gstub)) ^-1
Smith_plotBarc(ax(4),Zbs,Z0,[1 0 1])
% constant reactance arc plot line can also be called after defining Zbs
Zbs2=1j*imag(Zbs)
refl_Zstub=(Z0-Zbs2)/(Z0+Zbs2)
refl_Ystub=-refl_Zstub
plot(ax(4),real(refl_Ystub),imag(refl_Ystub),'ro')
Smith_plotRefLine2PhaseCircle(ax(4),Zbs2,Z0,[.2 .2 .8])
da=1/100;a_stub=[angle(refl_Ystub):da:pi];arc_stub2=da;
for k=1:1:numel(a_stub)
gamma_stub=cos(a_stub)+1j*sin(a_stub);
arc_stub2=arc_stub2+da;
plot(ax(4),real(gamma_stub),imag(gamma_stub),'bo','LineWidth',1.5);
end
arc_stub2=arc_stub2-da;
http://i68.tinypic.com/35mir1h.jpg
same as
________________________________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com attached: -- pozar_05_exercisee_03.m 4 / 10
MICROWAVE ENGINEERING – POZAR – IMPEDANCE MATCHING CHAPTER 05 EXERCISE 03 10/09/2018 23:19:02.
Without Smith chart, [POZAR] solves this single open shunt stub match directly with the following equations
RL=real(ZL);XL=imag(ZL);Y0=1/Z0;
% when RLZ0
t1=(XL+((RL*((Z0-RL)^2+XL^2))/Z0)^.5)/(RL-Z0) t1 = 7.071261637588793
t2=(XL-((RL*((Z0-RL)^2+XL^2))/Z0)^.5)/(RL-Z0) t2 = -0.671261637588793
% when RL=Z0
D1_TL=1/(2*pi)*atan(t1);if atan(t1)<0 D1_TL=D1_TL+.5; end D1_TL = 0.227640974365225
D2_TL=1/(2*pi)*atan(t2);if atan(t2)<0 D2_TL=D2_TL+.5; end D2_TL = 0.405911259087935
B1=(RL^2*t1-(Z0-XL*t1)*(XL+Z0*t1))/(Z0*(RL^2+(XL+Z0*t1)^2)) B1 = 0.012904205458629
B2=(RL^2*t2-(Z0-XL*t2)*(XL+Z0*t2))/(Z0*(RL^2+(XL+Z0*t2)^2)) B2 = -0.012904205458629
B1 and B2 are the reactances on the circle r=Z0. so stub input reactances 1j*Bs1 and 1j*Bs2
have to be the conjugates of 1j*B1 and 1j*B2
Frequency Response:
Checking frequency notch is correctly generated where expected. First gathering together all transmission line and stub lengths:
either combine
D_TL(1) = 0.405924682355882
Dstub(1) = 0.122549306180760
or
D_TL(2) = 0.227671146092940
Dstub(2) = 0.161542267238274
________________________________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com attached: -- pozar_05_exercisee_03.m 5 / 10
MICROWAVE ENGINEERING – POZAR – IMPEDANCE MATCHING CHAPTER 05 EXERCISE 03 10/09/2018 23:19:02.
Then the physical lengths of all transmission lines and stubs are:
L=D*c0/f0 L=
Columns 1 through 3
0.060848109885147 0.034127904799332 0.034123382057347
0.024334472488865 0.050851890303933 0.056602663533835
Column 4
0.060846097737281
0.018347336466165
GL=real(YL);BL=imag(YL);
s11=zeros(size(D,2),numel(f));
ZinTL=zeros(size(D,2),numel(f));
Zin_stb_oc=zeros(size(D,2),numel(f));
Zin=zeros(size(D,2),numel(f));
Zin=1./(ZinTL.^-1+Zin_stb_oc.^-1);
s11=(Zin-Z0)./(Zin+Z0);
s11_mod=abs(s11);
for k=1:1:size(s11_mod,1)
figure(10);plot(f,s11_mod(k,:));hold all;
end
grid on
title('TL + OC shunt stub |s11|');xlabel('f [Hz]')
legend('arc1','arc2','eq1','eq2','Location','northwest')
% 012-1
% 012-2
Directly sweeping frequency f, is equivalent to sweeping relative frequency f/f0 same frequency plot is obtained with the following lines:
frel=linspace(.5,1.5,numel(f));
% series transmission line input impedance
for k=1:1:size(L,2)
ZinTL(k,:)=Z0*(ZL+1j*Z0*tan(2*pi*frel*f0/c0*L(1,k)))./(Z0+1j*ZL*tan(2*pi*frel*f0/c0*L(1,k)));
end
% open circuit shunt stub input impedance
for k=1:1:size(D,2)
Zin_stb_oc(k,:)=Z0./(1j*tan(2*pi*L(2,k)*frel*f0/c0));
end
Zin=1./(ZinTL.^-1+Zin_stb_oc.^-1);
s11=(Zin-Z0)./(Zin+Z0);
s11_mod=abs(s11);
for k=1:1:size(s11_mod,1)
figure(11);plot(frel,s11_mod(k,:));hold all;
end
grid on
title('TL + OC shunt stub |s11|');xlabel('frel=f/f0')
legend('arc1','arc2','eq1','eq2','Location','northwest')
________________________________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com attached: -- pozar_05_exercisee_03.m 6 / 10
MICROWAVE ENGINEERING – POZAR – IMPEDANCE MATCHING CHAPTER 05 EXERCISE 03 10/09/2018 23:19:02.
Drel=linspace(.5,1.5,numel(f));
for k=1:1:size(L,2)
ZinTL(k,:)=Z0*(ZL+1j*Z0*tan(2*pi*Drel*D(1,k)))./(Z0+1j*ZL*tan(2*pi*Drel*D(1,k)));
% series transmission line input impedance
end
for k=1:1:size(D,2)
Zin_stb_oc(k,:)=Z0./(1j*tan(2*pi*Drel*D(2,k)));
% open circuit shunt stub input impedance
end
Zin=1./(ZinTL.^-1+Zin_stb_oc.^-1);
s11=(Zin-Z0)./(Zin+Z0);
s11_mod=abs(s11);
for k=1:1:size(s11_mod,1)
figure(12);plot(Drel,s11_mod(k,:));hold all;
end
grid on
title('TL + OC shunt stub |s11|');xlabel('Drel=[D/a a*D]')
legend('arc1','arc2','eq1','eq2','Location','northwest')
Complete overlap of frequency responses, between transmission lines and stub lengths obtained with the Smith chart and with the equations.
________________________________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com attached: -- pozar_05_exercisee_03.m 7 / 10
MICROWAVE ENGINEERING – POZAR – IMPEDANCE MATCHING CHAPTER 05 EXERCISE 03 10/09/2018 23:19:02.
When erroneously following the line and applying the following stub impedance instead of the correct reactance reading:
Smith_plotRefLine2PhaseCircle(ax,YL,1/Z0,[.2 .6 .2])
[x_swr,y_swr]=Smith_plotGammaCircle(ax,ZL,Z0,[1 .6 .6])
[g1x,g1y]=pol2cart(gamma_YL_angle,gamma_YL_mod)
[xr1,yr1]=Smith_plotRcircle(ax,Z0,Z0,[0 0 1])
[xint,yint]=intersections(x_swr,y_swr,xr1,yr1); plot(ax,xint,yint,'go')
gb1=xint(1)+1j*yint(1);gb1_angle=angle(gb1);gb1_mod=abs(gb1)
if gb1_angle<0 gb1_angle=2*pi+gb1_angle; end
if gb1_angle>(2*pi) gb1_angle=gb1_angle-2*pi; end
yb_1=1/Z0*((1+gb1)/(1-gb1))^-1
1/yb_1 % check already on r=1
Smith_plotRefLine2PhaseCircle(ax,1/yb_1,Z0,[.2 .8 .2])
Smith_plotRefLine2PhaseCircle(ax,1/Ybs,Z0,[.2 .2 .8])
Smith_plotBarc(ax,Zbs,Z0,[.8 .2 .8])
da=1/1000;a_stub=[angle(gstub):-da:-pi];arc_stub1=da;
erroneous reading, do not follow the line. but the arc, to correctly read
for k=1:1:numel(a_stub) reactances on the Smith Chart.
gamma_stub=.99*(cos(a_stub)+1j*sin(a_stub));
arc_stub1=arc_stub1+da;
plot(ax,real(gamma_stub),imag(gamma_stub),'bo','LineWidth',1.5);
end
While operating the equations, decision points keep showing up where signs
have to be discerned.
Yet, reading the covered arc, from the intersection point to Y Smith chart
Open Circuit -1+0*1j, it's simple and straight to get how long the stub has
to be.
________________________________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com attached: -- pozar_05_exercisee_03.m 8 / 10
MICROWAVE ENGINEERING – POZAR – IMPEDANCE MATCHING CHAPTER 05 EXERCISE 03 10/09/2018 23:19:02.
% calculating stub lenght Dstub2
Smith_plotRefLine2PhaseCircle(ax,YL,1/Z0,[.2 .6 .2])
[x_swr,y_swr]=Smith_plotGammaCircle(ax,ZL,Z0,[1 .6 .6])
[g1x,g1y]=pol2cart(gamma_YL_angle,gamma_YL_mod)
[xr1,yr1]=Smith_plotRcircle(ax,Z0,Z0,[0 0 1])
[xint,yint]=intersections(x_swr,y_swr,xr1,yr1); plot(ax,xint,yint,'go')
gb2=xint(2)+1j*yint(2);gb2_angle=angle(gb2);gb2_mod=abs(gb2)
if gb2_angle<0 gb2_angle=2*pi+gb2_angle; end
if gb2_angle>(2*pi) gb2_angle=gb2_angle-2*pi; end
Yb_2=1/Z0*((1+gb2)/(1-gb2))^-1
1/Yb_2 % check already on r=1
Smith_plotRefLine2PhaseCircle(ax,1/Yb_2,Z0,[.2 .8 .2])
gstub=conj(gb2)
plot(ax,real(gstub),imag(gstub),'bo')
Ybs=(1/Z0*(1+gstub)/(1-gstub)) % ^-1;
Smith_plotRefLine2PhaseCircle(ax,Ybs,1/Z0,[.2 .2 .8])
Smith_plotBarc(ax,Zbs,Z0,[.8 .2 .8])
da=1/1000;
a_stub=[angle(gstub):-da:-pi]; % Y Smtih chart, OC is -1+0*1j
arc_stub2=da;
for k=1:1:numel(a_stub)
gamma_stub=.99*(cos(a_stub)+1j*sin(a_stub));
arc_stub2=arc_stub2+da;
plot(ax,real(gamma_stub),imag(gamma_stub),'bo','LineWidth',1.5);
end
same as
While operating the equations, decision points keep showing up where signs
have to be discerned.
Yet, reading the covered arc, from the intersection point to Y Smith chart
Open Circuit -1+0*1j, it's simple and straight to get how long the stub has
to be.
________________________________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com attached: -- pozar_05_exercisee_03.m 9 / 10
MICROWAVE ENGINEERING – POZAR – IMPEDANCE MATCHING CHAPTER 05 EXERCISE 03 10/09/2018 23:19:02.
The error introduced by cutting OC shunt stubs a little bit shorter or longer is apparently a small angle error:
D_TL=[D1_TL_lambda D2_TL_lambda]
Dstub_err=[Dstub1_lambda_err Dstub2_lambda_err]
c0=2.998e8;
f0=2e9;
df=1e3;f1=1e9;f2=3e9;f=[f1:df:f2];
L=D*c0/f0
s11=zeros(size(D,2),numel(f));
ZinTL=zeros(size(D,2),numel(f));
Zin_stb_oc=zeros(size(D,2),numel(f));
Zin=zeros(size(D,2),numel(f));
for k=1:1:size(L,2)
ZinTL(k,:)=Z0*(ZL+1j*Z0*tan(2*pi*f/c0*L(1,k))) …
./(Z0+1j*ZL*tan(2*pi*f/c0*L(1,k)));
end
for k=1:1:size(D,2)
Zin_stb_oc(k,:)=Z0./(1j*tan(2*pi*L(2,k)*f/c0));
end
Zin=1./(ZinTL.^-1+Zin_stb_oc.^-1);
s11=(Zin-Z0)./(Zin+Z0);
s11_mod=abs(s11);
for k=1:1:size(s11_mod,1)
hf(100)=figure(100);plot(f,s11_mod(k,:));hold all;
end
grid on
title('TL + error 2nd decimal OC shunt stub |s11|');
xlabel('f [Hz]')
legend('arc1','arc2','eq1','eq2','Location','northwest')
Observation: On reading the wrong OC shunt stub input reactance on the Smith chart, despite both stubs being then a little bit too short, one OC stub
pushes the deteriorated frequency notch to a slightly higher frequency , while the other, still being a bit shorter than it should be, it shifts the deteriorated
frequency notch to a slightly lower frequency. So, for fine tuning, it's not always 'shorter' for higher frequencies or 'longer' for lower frequencies.
________________________________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com attached: -- pozar_05_exercisee_03.m 10 / 10