You are on page 1of 11

# MICROWAVE ENGINEERING – POZAR – IMPEDANCE MATCHING CHAPTER 05 EXERCISE 12 07/10/2018 04:54:15.

12.-
12.1.- single shunt short circuit stub (added shunt open single stub calculation)

pozar_05_exercise_12.m
% calculating lengths
clc;clear all;close all;
delete('pozar_05_12_vars.mat')

% 12.1

ZL=200;YL=ZL;Z0=100;Y0=1/Z0;RL=real(ZL);XL=imag(ZL);GL=real(YL);BL=imag(YL);

% when RL~=Z0
t1=(XL+((RL*((Z0-RL)^2+XL^2))/Z0)^.5)/(RL-Z0); t1 = 1.414213562373095
t2=(XL-((RL*((Z0-RL)^2+XL^2))/Z0)^.5)/(RL-Z0); t2 = -1.414213562373095

% when RL=Z0
D1_TL=1/(2*pi)*atan(t1);if t1<0 D1_TL=D1_TL+.5; end
D2_TL=1/(2*pi)*atan(t2);if t2<0 D2_TL=D2_TL+.5; end

## D1_TL D1_TL = 0.152043361992348

D2_TL D2_TL = 0.347956638007652

B1=(RL^2*t1-(Z0-XL*t1)*(XL+Z0*t1))/(Z0*(RL^2+(XL+Z0*t1)^2)) B1 = 0.007071067811865
B2=(RL^2*t2-(Z0-XL*t2)*(XL+Z0*t2))/(Z0*(RL^2+(XL+Z0*t2)^2)) B2 = -0.007071067811865
D1stub_sc=1/(2*pi)*atan(Y0/B1); if (Y0/B1)<0 D1stub_sc=D1stub_sc+.5; end
D1stub_oc=-1/(2*pi)*atan(B1/Y0); if atan(B1/Y0)>0 D1stub_oc=D1stub_oc+.5; end

## D2stub_sc=1/(2*pi)*atan(Y0/B2); if (Y0/B2)<0 D2stub_sc=D2stub_sc+.5; end

D2stub_oc=-1/(2*pi)*atan(B2/Y0); if atan(B2/Y0)>0 D2stub_oc=D2stub_oc+.5; end
D1stub_sc = 0.152043361992348
D1stub_sc D1stub_oc = 0.402043361992348
D1stub_oc
D2stub_sc = 0.347956638007652
D2stub_sc D2stub_oc = 0.097956638007652
D2stub_oc

% storing results in variables for frequency BW comparison last point of this exercise:

D1_TL_shunt_singlestub=D1_TL;D2_TL_shunt_singlestub=D2_TL;
D1stub_sc_shunt_singlestub=D1stub_sc;D2stub_sc_shunt_singlestub=D2stub_sc;
D1stub_oc_shunt_singlestub=D1stub_oc;D2stub_oc_shunt_singlestub=D2stub_oc;

if (isempty(dir('pozar_05_12_vars.mat')))
save('pozar_05_12_vars.mat','D1_TL_shunt_singlestub','D2_TL_shunt_singlestub', ...
'D1stub_sc_shunt_singlestub','D2stub_sc_shunt_singlestub', ...
'D1stub_oc_shunt_singlestub','D2stub_oc_shunt_singlestub');
else
save('pozar_05_12_vars.mat','D1_TL_shunt_singlestub','D2_TL_shunt_singlestub', ...
'D1stub_sc_shunt_singlestub','D2stub_sc_shunt_singlestub', ...
'D1stub_oc_shunt_singlestub','D2stub_oc_shunt_singlestub','-append');
end

_________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com 1 / 11
MICROWAVE ENGINEERING – POZAR – IMPEDANCE MATCHING CHAPTER 05 EXERCISE 12 07/10/2018 04:54:15.

From 12.1 throughout 12.8 finding transmission line length D_TL and stub length Dstub either shorted or open.

## In 12.9 we are going to measure and compare frequency bandwidths.

In order to reuse plotting loops, saving and retrieving TL and stub lengths to .mat file pozar_05_12_vars.mat.

12.2.- single series short circuit stub (added calculations for series open single stub)

%% 12.2 single series short circuit stub (added calculations for series open single stub)

% when GL=~Y0
t1=(BL+((GL*((Y0-GL)^2+BL^2))/Y0)^.5)/(GL-Y0)
t2=(BL-((GL*((Y0-GL)^2+BL^2))/Y0)^.5)/(GL-Y0)
t1 = -0.707106781186548
% when GL=Y0
if t1>=0 D1_TL=1/(2*pi)*atan(t1); elseif t1<0 D1_TL=1/(2*pi)*atan(t1)+.5; end
t2 = 0.707106781186548
if t2>=0 D2_TL=1/(2*pi)*atan(t2); elseif t2<0 D2_TL=1/(2*pi)*atan(t2)+.5; end

D1_TL
D2_TL D1_TL = 0.402043361992348
D2_TL = 0.097956638007652
X1=1/Y0*(GL^2*t1-(Y0-t1*BL)*(BL+t1*Y0))/(GL^2+(BL+Y0*t1)^2)
X2=1/Y0*(GL^2*t2-(Y0-t2*BL)*(BL+t2*Y0))/(GL^2+(BL+Y0*t2)^2)
X1 = 70.710678118654755
D1stub_sc=1/(2*pi)*atan(-X1/Z0);if atan(X1/Z0)<0 D1stub_sc=D1stub_sc+.5;end X2 = -70.710678118654755
D1stub_oc=1/(2*pi)*atan(Z0/X1);if atan(Z0/X1)<0 D1stub_oc=D1stub_oc+.5;end

## D2stub_sc=1/(2*pi)*atan(-X2/Z0);if atan(X2/Z0)<0 D2stub_sc=D2stub_sc+.5;end

D2stub_oc=1/(2*pi)*atan(Z0/X2);if atan(Z0/X2)<0 D2stub_oc=D2stub_oc+.5;end

D1_TL
D2_TL
D1stub_sc = 0.097956638007652
D2stub_sc = 0.402043361992348
D1stub_sc
D2stub_sc D1stub_oc = 0.347956638007652
D2stub_oc = 0.152043361992348
D1stub_oc
D2stub_oc

% storing results in variables with different manes for frequency BW comparison last point of this exercise:

D1_TL_series_singlestub=D1_TL;D2_TL_series_singlestub=D2_TL;
D1stub_sc_series_singlestub=D1stub_sc;
D2stub_sc_series_singlestub=D2stub_sc;
D1stub_oc_series_singlestub=D1stub_oc;
D2stub_oc_series_singlestub=D2stub_oc;

if (isempty(dir('pozar_05_12_vars.mat')))
save('pozar_05_12_vars.mat','D1_TL_series_singlestub','D2_TL_series_singlestub', ...
'D1stub_sc_series_singlestub','D2stub_sc_series_singlestub',...
'D1stub_oc_series_singlestub','D2stub_oc_series_singlestub');
else save('pozar_05_12_vars.mat','D1_TL_series_singlestub','D2_TL_series_singlestub', ...
'D1stub_sc_series_singlestub','D2stub_sc_series_singlestub',...
'D1stub_oc_series_singlestub','D2stub_oc_series_singlestub','-append');

end
% to cell 12.9.2

_________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com 2 / 11
MICROWAVE ENGINEERING – POZAR – IMPEDANCE MATCHING CHAPTER 05 EXERCISE 12 07/10/2018 04:54:15.

## 12.3.- double shunt short circuit stubs

(added shunt open double stub calculations)

% 12.3 double shunt short circuit stubs (added shunt open double stub calculations)

ZL=200;Z0=100;Y0=1/Z0;YL=1/ZL;GL=real(YL);BL=imag(YL);D_TL=1/8;t=tan(2*pi*D_TL)

B11=-BL+1/t*(Y0+((1+t^2)*GL*Y0-GL^2*t^2)^.5)
B12=-BL-1/t*(Y0-((1+t^2)*GL*Y0-GL^2*t^2)^.5)
t = 1.000000000000000

## B21=(-Y0*(Y0*GL*(1+t^2)-GL^2*t^2)^.5+GL*Y0)/(GL*t) B11 = 0.018660254037844

B22=(Y0*(Y0*GL*(1+t^2)-GL^2*t^2)^.5+GL*Y0)/(GL*t) B12 = -0.001339745962156

## D11stub_oc=1/(2*pi)*atan(B11/Y0);if atan(B11/Y0)<0 D11stub_oc=D11stub_oc+.5; end; B21 = -0.007320508075689

D12stub_oc=1/(2*pi)*atan(B12/Y0);if atan(B12/Y0)<0 D12stub_oc=D12stub_oc+.5; end; B22 = 0.027320508075689
D21stub_oc=1/(2*pi)*atan(B21/Y0);if atan(B21/Y0)<0 D21stub_oc=D21stub_oc+.5; end;
D22stub_oc=1/(2*pi)*atan(B22/Y0);if atan(B22/Y0)<0 D22stub_oc=D22stub_oc+.5; end;

## D11stub_sc=-1/(2*pi)*atan(Y0/B11);if atan(Y0/B11)>0 D11stub_sc=D11stub_sc+.5; end;

D12stub_sc=-1/(2*pi)*atan(Y0/B12);if atan(Y0/B12)>0 D12stub_sc=D12stub_sc+.5; end;
D21stub_sc=-1/(2*pi)*atan(Y0/B21);if atan(Y0/B21)>0 D21stub_sc=D21stub_sc+.5; end;
D22stub_sc=-1/(2*pi)*atan(Y0/B22);if atan(Y0/B22)>0 D22stub_sc=D22stub_sc+.5; end;

D11stub_oc
D12stub_oc
D21stub_oc
D22stub_oc D11stub_oc = 0.171703373799962
D12stub_oc = 0.478803499409917
D11stub_sc D21stub_oc = 0.399427713574991
D12stub_sc D22stub_oc = 0.194155807330508
D21stub_sc
D22stub_sc
D11stub_sc = 0.4217033737999
% storing results D12stub_sc = 0.228803499409917
D21stub_sc = 0.149427713574991
D1_TL_shunt_doublestub=D_TL; D22stub_sc = 0.444155807330508
D11stub_oc_shunt_doublestub=D11stub_oc;
D12stub_oc_shunt_doublestub=D12stub_oc;
D21stub_oc_shunt_doublestub=D21stub_oc;
D22stub_oc_shunt_doublestub=D22stub_oc;

D11stub_sc_shunt_doublestub=D11stub_sc;
D12stub_sc_shunt_doublestub=D12stub_sc;
D21stub_sc_shunt_doublestub=D21stub_sc;
D22stub_sc_shunt_doublestub=D22stub_sc;

if (isempty(dir('pozar_05_12_vars.mat')))
save('pozar_05_12_vars.mat',...
'D11stub_oc_shunt_doublestub','D12stub_oc_shunt_doublestub', ...
'D21stub_oc_shunt_doublestub','D22stub_oc_shunt_doublestub', ...
'D11stub_oc_shunt_doublestub','D12stub_oc_shunt_doublestub', ...
'D21stub_oc_shunt_doublestub','D22stub_oc_shunt_doublestub');
else
save('pozar_05_12_vars.mat',...
'D11stub_oc_shunt_doublestub','D12stub_oc_shunt_doublestub',...
'D21stub_oc_shunt_doublestub','D22stub_oc_shunt_doublestub', ...
'D11stub_oc_shunt_doublestub','D12stub_oc_shunt_doublestub', ...
'D21stub_oc_shunt_doublestub','D22stub_oc_shunt_doublestub','-append')
end

_________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com 3 / 11
MICROWAVE ENGINEERING – POZAR – IMPEDANCE MATCHING CHAPTER 05 EXERCISE 12 07/10/2018 04:54:15.

## (added shunt open stub calculations)

D_TL=1/8;t=tan(2*pi*D_TL)
t = 1.000000000000000
X11=-XL+1/t*(Z0+((1+t^2)*RL*Z0-RL^2*t^2)^.5)
X12=-XL+1/t*(Z0-((1+t^2)*RL*Z0-RL^2*t^2)^.5)
X11 = 1.000000000000000e+02
X21=1/(RL*t)*(+Z0*(Z0*RL*(1+t^2)-RL^2*t^2)^.5+RL*Z0) X12 = 1.000000000000000e+02
X22=1/(RL*t)*(-Z0*(Z0*RL*(1+t^2)-RL^2*t^2)^.5+RL*Z0)
X21 = 1.000000000000000e+02
D11stub_oc=1/(2*pi)*atan(Z0/X11);if atan(Z0/X11)<0 D11stub_oc=D11stub_oc+.5; end; X22 = 1.000000000000000e+02
D12stub_oc=1/(2*pi)*atan(Z0/X12);if atan(Z0/X12)<0 D12stub_oc=D12stub_oc+.5; end;
D21stub_oc=1/(2*pi)*atan(Z0/X21);if atan(Z0/X21)<0 D21stub_oc=D21stub_oc+.5; end;
D22stub_oc=1/(2*pi)*atan(Z0/X22);if atan(Z0/X22)<0 D22stub_oc=D22stub_oc+.5; end;

## D11stub_sc=-1/(2*pi)*atan(X11/Z0);if atan(X11/Z0)>0 D11stub_sc=D11stub_sc+.5; end;

D12stub_sc=-1/(2*pi)*atan(X12/Z0);if atan(X12/Z0)>0 D12stub_sc=D12stub_sc+.5; end;
D21stub_sc=-1/(2*pi)*atan(X21/Z0);if atan(X21/Z0)>0 D21stub_sc=D21stub_sc+.5; end;
D22stub_sc=-1/(2*pi)*atan(X22/Z0);if atan(X22/Z0)>0 D22stub_sc=D22stub_sc+.5; end;

D11stub_oc
D12stub_oc
D21stub_oc
D22stub_oc
D11stub_oc = 0.125
D11stub_sc D12stub_oc = 0.125
D12stub_sc D21stub_oc = 0.125
D21stub_sc D22stub_oc = 0.125
D22stub_sc

## % storing results D11stub_sc = 0.375

D_TL_series_doublestub=D_TL D12stub_sc = 0.375
D11stub_sc_series_doublestub=D11stub_sc; D21stub_sc = 0.375
D12stub_sc_series_doublestub=D12stub_sc; D22stub_sc = 0.375
D21stub_sc_series_doublestub=D21stub_sc;
D22stub_sc_series_doublestub=D22stub_sc;

D11stub_oc_series_doublestub=D11stub_oc;
D12stub_oc_series_doublestub=D12stub_oc;
D21stub_oc_series_doublestub=D21stub_oc;
D22stub_oc_series_doublestub=D22stub_oc;

if (isempty(dir('pozar_05_12_vars.mat')))
save('pozar_05_12_vars.mat',...
'D11stub_oc_series_doublestub','D12stub_oc_series_doublestub', ...
'D21stub_oc_series_doublestub','D22stub_oc_series_doublestub', ...
'D11stub_oc_series_doublestub','D12stub_oc_series_doublestub', ...
'D21stub_oc_series_doublestub','D22stub_oc_series_doublestub');
else
save('pozar_05_12_vars.mat',...
'D11stub_oc_series_doublestub','D12stub_oc_series_doublestub', ...
'D21stub_oc_series_doublestub','D22stub_oc_series_doublestub', ...
'D11stub_oc_series_doublestub','D12stub_oc_series_doublestub', ...
'D21stub_oc_series_doublestub','D22stub_oc_series_doublestub','-append')
end

While 12.3 and 12.4 have constant TL length to avoid complicating calculations, if instead D3=1/4, 3/8, or 1.2/8 then this equation approach doesn't
work, stub lengths come up complex which is one of the limitations for not using the Smith chart or simulator with optimiser.

## D112stub_oc = 0.0966 D113stub_oc = 0.0561 D114stub_oc = 0.0476 D115stub_oc = 0.0416

D122stub_oc = 0.1593 D123stub_oc = 0.2438 D124stub_oc = 0.2705 D125stub_oc = 0.2916
D212stub_oc = 0.1080 D213stub_oc = 0.0723 D214stub_oc = 0.0628 D215stub_oc = 0.0558
D222stub_oc = 0.1388 D223stub_oc = 0.1519 D224stub_oc = 0.1514 D225stub_oc = 0.1494

## D112stub_sc = 0.3466 D113stub_sc = 0.3061 D114stub_sc = 0.2976 D115stub_sc = 0.2916

D122stub_sc = 0.4093 D123stub_sc = 0.4938 D124stub_sc = 0.0205 D125stub_sc = 0.0416
D212stub_sc = 0.3580 D213stub_sc = 0.3223 D214stub_sc = 0.3128 D215stub_sc = 0.3058
D222stub_sc = 0.3888 D223stub_sc = 0.4019 D224stub_sc = 0.4014 D225stub_sc = 0.3994

_________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com 4 / 11
MICROWAVE ENGINEERING – POZAR – IMPEDANCE MATCHING CHAPTER 05 EXERCISE 12 07/10/2018 04:54:15.

## 12.9.- best BW? with D=L0/lambda, lambda0=c/f0, L0=D*lambda0, then 12.9.1.-

2*pi/lambda*D*lambda0=2*pi*f/c*D*c/f0
beta*L0=2*pi*D=2*pi*D*f/f0

## input impedance for ideal stubs and TL:

Zin_stub_sc=1j*Z0*tan(2*pi*L*f/c)
Zin_stub_oc=Z0/(1j*tan(2*pi*L*f/c))
Zin_TL=(ZL+1j*tan(2*pi*D*f/f0))/(Z0+1j*ZL*tan(2*pi*D*f/f0))

%% 12.9.1
% run Shift+Enter at least 12.1 first to generate stub and TL lengths

ZL=200;Z0=100;Y0=1/Z0;YL=1/ZL;GL=real(YL);BL=imag(YL);
c=3e8;f0=2e9;df=1e5;f1=1e9;f2=3e9;f=[f1:df:f2];

s11=zeros(1,numel(f));s11_mod=zeros(1,numel(f));

ZinTL=Z0*(ZL+1j*Z0*tan(2*pi*D1_TL_shunt_singlestub ...
*f/f0))./(Z0+1j*ZL*tan(2*pi*D1_TL_shunt_singlestub *f/f0));
Zin_stb_sc=1j*Z0*tan(2*pi*D1stub_sc_shunt_singlestub*f/f0); % shunt stub
Zin=1./(ZinTL.^-1+Zin_stb_sc.^-1);
s11=[s11_mod;(Zin-Z0)./(Zin+Z0)];
s11_mod=[s11_mod;abs((Zin-Z0)./(Zin+Z0))];

ZinTL=Z0*(ZL+1j*Z0*tan(2*pi*D1_TL_shunt_singlestub ...
*f/f0))./(Z0+1j*ZL*tan(2*pi*D1_TL_shunt_singlestub *f/f0));
Zin_stb_sc=Z0./(1j*tan(2*pi*D1stub_oc_shunt_singlestub*f/f0)); % series stub
Zin=1./(ZinTL.^-1+Zin_stb_sc.^-1);
s11=[s11_mod;(Zin-Z0)./(Zin+Z0)];
s11_mod=[s11_mod;abs((Zin-Z0)./(Zin+Z0))];

ZinTL=Z0*(ZL+1j*Z0*tan(2*pi*D2_TL_shunt_singlestub ...
*f/f0))./(Z0+1j*ZL*tan(2*pi*D2_TL_shunt_singlestub *f/f0));
Zin_stb_sc=1j*Z0*tan(2*pi*D2stub_sc_shunt_singlestub*f/f0); % shunt stub
Zin=1./(ZinTL.^-1+Zin_stb_sc.^-1);
s11=[s11_mod;(Zin-Z0)./(Zin+Z0)];
s11_mod=[s11_mod;abs((Zin-Z0)./(Zin+Z0))];

ZinTL=Z0*(ZL+1j*Z0*tan(2*pi*D2_TL_shunt_singlestub ...
*f/f0))./(Z0+1j*ZL*tan(2*pi*D2_TL_shunt_singlestub *f/f0));
Zin_stb_sc=Z0./(1j*tan(2*pi*D2stub_oc_shunt_singlestub*f/f0)); % series stub
Zin=1./(ZinTL.^-1+Zin_stb_sc.^-1);
s11=[s11_mod;(Zin-Z0)./(Zin+Z0)];
s11_mod=[s11_mod;abs((Zin-Z0)./(Zin+Z0))];

s11_mod(1,:)=[];
s11(1,:)=[];

% s11_oc2=s11(4,:)'; smithchart(s11_oc2); %

for k=1:1:size(s11_mod,1)
figure(1);plot(f,s11_mod(k,:));hold all;
end
grid on
title('short/open shunt single stub |s11|')
legend('DTL1 D1 sc','DTL1 D2 oc','DTL2 D2 sc','DTL2 D2 oc','Location','northwest')

for k=1:1:size(s11_mod,1)
figure(2);plot(f,10*log10(s11_mod(k,:)));axis([1e9 3e9 -35 0]);hold all;
end
grid on;grid minor
title('short/open shunt single stub 10log(|s11|)')
legend('DTL1 D1 sc','DTL1 D2 oc','DTL2 D2 sc','DTL2 D2 oc','Location','northwest')

for k=1:1:size(s11_mod,1)
figure(3);plot(f,20*log10(s11_mod(k,:)));axis([1.7e9 2.3e9 -20 -10]);hold all;
end
grid on;grid minor
title('20dB Return Loss BW for short/open shunt single stub')
legend('DTL1 D1 sc','DTL1 D2 oc','DTL2 D2 sc','DTL2 D2 oc','Location','northwest')

_________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com 5 / 11
MICROWAVE ENGINEERING – POZAR – IMPEDANCE MATCHING CHAPTER 05 EXERCISE 12 07/10/2018 04:54:15.

## measuring Return Loss below -20dB bandwidth:

a=10*log10(s11_mod(1,:));a_below20=a(a<-20);
[nx,f_below20]=find(a<-20);f_bw=f(f_below20);
figure(2);plot(f_bw,a_below20,'bo')

BW_band_RL20dB_singleshuntstub=[min(f_bw) BW_band_RL20dB_singleshuntstub
max(f_bw)] =
1.0e+09 *
1.983100000000000
2.017200000000000

BW_RL20dB_singleshuntstub=... BW_RL20dB_singleshuntstub =
34100000
abs(min(f_bw)-max(f_bw))

save('pozar_05_12_vars.mat',…
'BW_band_RL20dB_singleshuntstub',…
'BW_RL20dB_singleshuntstub')

what may happen if crossing one set of TL length and stub lengths?

## % run Shift+Enter at least 12.1 first to generate stub and TL lengths

ZL=200;Z0=100;Y0=1/Z0;YL=1/ZL;GL=real(YL);BL=imag(YL);
c=3e8;f0=2e9;df=1e5;f1=1e9;f2=3e9;f=[f1:df:f2];

DTL=[D1_TL_shunt_singlestub D2_TL_shunt_singlestub]

Dstb=[D1stub_sc_shunt_singlestub D1stub_oc_shunt_singlestub;
D2stub_sc_shunt_singlestub D2stub_oc_shunt_singlestub];

s11=zeros(1,numel(f));s11_mod=zeros(1,numel(f));
for k=1:1:numel(DTL)
for s=1:1:size(Dstb,1)

ZinTL=Z0*(ZL+1j*Z0*tan(2*pi*DTL(k)*(f)/f0))./(Z0+1j*ZL*tan(2*pi*DTL(k)*(f)/f0));
Zin_stb_sc=1j*Z0*tan(2*pi*Dstb(k,s)*(f)/f0);
Zin=1./(ZinTL.^-1+Zin_stb_sc.^-1);
s11=[s11_mod;(Zin-Z0)./(Zin+Z0)];
s11_mod=[s11_mod;abs((Zin-Z0)./(Zin+Z0))];
end
end
s11_mod(1,:)=[];s11(1,:)=[];

for k=1:1:size(s11_mod,1)
figure(1);plot(f,s11_mod(k,:));hold all;
end
grid on
title('short/open shunt single stub |s11|')
legend('DTL1 D1 sc','DTL1 D2 oc','DTL2 D2 sc','DTL2 D2 oc','Location','northwest')

for k=1:1:size(s11_mod,1)
figure(2);plot(f,10*log10(s11_mod(k,:)));axis([1e9 3e9 -35 0]);hold all;
end
grid on;grid minor
title('short/open shunt single stub 10log(|s11|)')
legend('DTL1 D1 sc','DTL1 D2 oc','DTL2 D2 sc','DTL2 D2 oc','Location','northwest')

for k=1:1:size(s11_mod,1)
figure(3);plot(f,20*log10(s11_mod(k,:)));axis([1.7e9 2.3e9 -20 -10]);hold all;
end
grid on;grid minor
title('20dB Return Loss BW for short/open shunt single stub')
legend('DTL1 D1 sc','DTL1 D2 oc','DTL2 D2 sc','DTL2 D2 oc','Location','northwest')

_________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com 6 / 11
MICROWAVE ENGINEERING – POZAR – IMPEDANCE MATCHING CHAPTER 05 EXERCISE 12 07/10/2018 04:54:15.

One way to manually fix the previously crossed open circuit stub lengths:

ZL=200;Z0=100;Y0=1/Z0;YL=1/ZL;GL=real(YL);BL=imag(YL);
c=3e8;f0=2e9;df=1e5;f1=1e9;f2=3e9;f=[f1:df:f2];

DTL=[D1_TL_shunt_singlestub D2_TL_shunt_singlestub]
Dstb=[D1stub_sc_shunt_singlestub...
D1stub_oc_shunt_singlestub+.054; % |s11| manual correction
D2stub_sc_shunt_singlestub...
D2stub_oc_shunt_singlestub-.054]; % |s11| manual correction

s11=zeros(1,numel(f));s11_mod=zeros(1,numel(f));
for k=1:1:numel(DTL)
for s=1:1:size(Dstb,1)
ZinTL=...
Z0*(ZL+1j*Z0*tan(2*pi*DTL(k)*(f)/f0))./(Z0+1j*ZL*tan(2*pi*DTL(k)*(f)/f0));
Zin_stb_sc=1j*Z0*tan(2*pi*Dstb(k,s)*(f)/f0);
Zin=1./(ZinTL.^-1+Zin_stb_sc.^-1);
s11=[s11_mod;(Zin-Z0)./(Zin+Z0)];
s11_mod=[s11_mod;abs((Zin-Z0)./(Zin+Z0))];
end
end
s11_mod(1,:)=[];
s11(1,:)=[];

for k=1:1:size(s11_mod,1)
figure(1);plot(f,s11_mod(k,:));hold all;
end
grid on
title('short shunt single stub')
legend('DTL1 D1 sc','DTL1 D2 oc','DTL2 D2 sc','DTL2 D2 oc','Location','northwest')

for k=1:1:size(s11_mod,1)
figure(2);plot(f,10*log10(s11_mod(k,:)));axis([1e9 3e9 -35 0]);hold all;
end
grid on;grid minor
title('short shunt single stub')
legend('DTL1 D1 sc','DTL1 D2 oc','DTL2 D2 sc','DTL2 D2 oc','Location','northwest')

% s11_oc2=s11(4,:)'; smithchart(s11_oc2);

for k=1:1:size(s11_mod,1)
figure(3);plot(f,20*log10(s11_mod(k,:)));axis([1.7e9 2.3e9 -20 -10]);hold all;
end
grid on;grid minor
title('20dB Return Loss BW for short/open shunt single stub')
legend('DTL1 D1 sc','DTL1 D2 oc','DTL2 D2 sc','DTL2 D2 oc','Location','northwest')

BW_band_RL20dB_singleshuntstub=[0 0];BW_RL20dB_singleshuntstub(1)=0
for k=1:1:size(s11_mod,1)
a=10*log10(s11_mod(k,:));
a_below20=a(a<-20);
[nx,f_below20]=find(a<-20);
f_bw=f(f_below20);
% figure(2);plot(f_bw,a_below20,'bo')
BW_band_RL20dB_singleshuntstub= [BW_band_RL20dB_singleshuntstub;
min(f_bw) max(f_bw)];
BW_RL20dB_singleshuntstub= [BW_RL20dB_singleshuntstub;
abs(min(f_bw)-max(f_bw))];
end
BW_band_RL20dB_singleshuntstub =
BW_band_RL20dB_singleshuntstub(1,:)=[];BW_RL20dB_singleshuntstub(1)=[]; 1.0e+09 *
1.983100000000000 2.017200000000000
BW_band_RL20dB_sinheshuntstub 1.991200000000000 2.009000000000000
BW_RL20dB_singleshuntstub 1.992500000000000 2.007400000000000
1.989200000000000 2.010700000000000
% storing
save('pozar_05_12_vars.mat',.. BW_RL20dB_singleshuntstub =
'BW_band_RL20dB_singleshuntstub', BW_RL20dB_singleshuntstub') 34100000
17800000
14900000
21500000
the line s11_oc2=s11(4,:)'; smithchart(s11_oc2); only used for test, if attempting to plot more than one sij on Smith chart with command
smithchart, feed a 2x2xN matrix, otherwise hold all doesn't work and only one sij is plotted on the Smith chart.

_________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com 7 / 11
MICROWAVE ENGINEERING – POZAR – IMPEDANCE MATCHING CHAPTER 05 EXERCISE 12 07/10/2018 04:54:15.

12.9.2

ZL=200;Z0=100;Y0=1/Z0;YL=1/ZL;GL=real(YL);BL=imag(YL);
c=3e8;f0=2e9;df=1e5;f1=1e9;f2=3e9;f=[f1:df:f2];
s11=zeros(1,numel(f));s11_mod=zeros(1,numel(f));

ZinTL=Z0*(ZL+1j*Z0*tan(2*pi*D1_TL_series_singlestub ...
*f/f0))./(Z0+1j*ZL*tan(2*pi*D1_TL_series_singlestub *f/f0));
Zin_stb_sc=Z0*1j*tan(2*pi*D1stub_sc_series_singlestub*f/f0); % short circuit stub
Zin=ZinTL+Zin_stb_sc; s11=[s11_mod;(Zin-Z0)./(Zin+Z0)];
s11_mod=[s11_mod;abs((Zin-Z0)./(Zin+Z0))];

ZinTL=Z0*(ZL+1j*Z0*tan(2*pi*D1_TL_series_singlestub ...
*f/f0))./(Z0+1j*ZL*tan(2*pi*D1_TL_series_singlestub *f/f0));
Zin_stb_sc=Z0./(1j*tan(2*pi*D1stub_oc_series_singlestub*f/f0)); % open stub
Zin=ZinTL+Zin_stb_sc;s11=[s11_mod;(Zin-Z0)./(Zin+Z0)];
s11_mod=[s11_mod;abs((Zin-Z0)./(Zin+Z0))];

ZinTL=Z0*(ZL+1j*Z0*tan(2*pi*D2_TL_series_singlestub ...
*f/f0))./(Z0+1j*ZL*tan(2*pi*D2_TL_series_singlestub *f/f0));
Zin_stb_sc=1j*Z0*tan(2*pi*D2stub_sc_series_singlestub*f/f0); % short circuit stub
Zin=ZinTL+Zin_stb_sc;s11=[s11_mod;(Zin-Z0)./(Zin+Z0)];
s11_mod=[s11_mod;abs((Zin-Z0)./(Zin+Z0))];

ZinTL=Z0*(ZL+1j*Z0*tan(2*pi*D2_TL_series_singlestub ...
*f/f0))./(Z0+1j*ZL*tan(2*pi*D2_TL_series_singlestub *f/f0));
Zin_stb_sc=Z0./(1j*tan(2*pi*D2stub_oc_series_singlestub*f/f0)); % open stub
Zin=ZinTL+Zin_stb_sc; s11=[s11_mod;(Zin-Z0)./(Zin+Z0)];
s11_mod=[s11_mod;abs((Zin-Z0)./(Zin+Z0))];

s11_mod(1,:)=[];s11(1,:)=[];

for k=1:1:size(s11_mod,1)
figure(1);plot(f,s11_mod(k,:));hold all;
end
grid on
title('short/open series single stub |s11|')
legend('DTL1 D1 sc','DTL2 D1 oc','DTL1 D2 sc','DTL2 D2 oc','Location','northwest')

for k=1:1:size(s11_mod,1)
figure(2);plot(f,10*log10(s11_mod(k,:)));axis([1e9 3e9 -35 0]);hold all;
end
grid on;grid minor
title('short/open series single stub 10log(|s11|)')
legend('DTL1 D1 sc','DTL2 D1 oc','DTL1 D2 sc','DTL2 D2 oc','Location','northwest')

for k=1:1:size(s11_mod,1)
figure(3);plot(f,20*log10(s11_mod(k,:)));axis([1.7e9 2.3e9 -20 -10]);hold all;
end
grid on;grid minor
title('20dB Return Loss BW for short/open series single stub')
legend('DTL1 D1 sc','DTL2 D1 oc','DTL1 D2 sc','DTL2 D2 oc','Location','northwest')

## measuring Return Loss below -20dB bandwidth, plotting

points of a single |s11|dB trace below -20dB:

a=10*log10(s11_mod(1,:));a_below20=a(a<-20) BW_band_RL20dB_singleseriestub
[nx,f_below20]=find(a<-20);f_bw=f(f_below20) =
figure(2);plot(f_bw,a_below20,'bo') 1.0e+09 *
BW_band_RL20dB_singleseriestub=[min(f_bw) max(f_bw)] 1.988900000000000
% measuring 1 bandwidth 2.011100000000000
BW_band_RL20dB_singleseriestub=[0 0];
BW_RL20dB_singleseriestub(1)=0; BW_RL20dB_singleseriestub =
% measuring BW of all calculated single series stub matches 22200000
for k=1:1:size(s11_mod,1)
a=10*log10(s11_mod(k,:)); a_below20=a(a<-20);
BW_band_RL20dB_singleseriestub
[nx,f_below20]=find(a<-20); f_bw=f(f_below20);
=
% figure(2);plot(f_bw,a_below20,'bo') 1.0e+09 *
BW_band_RL20dB_singleseriestub=...
1.988900000000000
[BW_band_RL20dB_singleseriestub;
2.011100000000000
min(f_bw) max(f_bw)];
1.991200000000000
BW_RL20dB_singleseriesstub=...
2.008900000000000
[BW_RL20dB_singleseriesstub;
1.993300000000000
abs(min(f_bw)-max(f_bw))];
2.006500000000000
end
1.989100000000000
BW_band_RL20dB_singleseriestub=[];
2.010700000000000
BW_RL20dB_singleseriestub(1)=[];
BW_RL20dB_singleseriestub =
17700000
BW_band_RL20dB_doubleshuntstub
13200000
BW_RL20dB_doubleshuntstub
21600000
% storing 22200000
save('pozar_05_12_vars.mat',... 17700000
'BW_band_RL20dB_doubleshuntstub',… 13200000
'BW_RL20dB_doubleshuntstub') 21600000

_________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com 8 / 11
MICROWAVE ENGINEERING – POZAR – IMPEDANCE MATCHING CHAPTER 05 EXERCISE 12 07/10/2018 04:54:15.

## command find doesn't work as used in right hand side f_bw_s11_20dBdown_1=find(s11_mod<=-19.99)

f_bw_s11_20dBdown_2=find(s11_mod>=-20.01)

## this crashes, too many points passed to intersection marker_line_10=-10*ones(1,numel(f))

figure(2); plot(f,marker_line_10)
[x,y]=intersections(f,marker_line_10,f,s11_mod(1,:))

## 12.9.3.- double shunt short circuit stubs

(added shunt open double stub calculations)

c=3e8;f0=2e9;df=1e5;f1=1e9;f2=3e9;f=[f1:df:f2];

s11=zeros(1,numel(f));s11_mod=zeros(1,numel(f));

Zin_stb1_sc=Z0*1j*tan(2*pi*(D11stub_sc_shunt_doublestub)*f/f0); % sc
Y1=YL+1./Zin_stb1_sc;
ZinTL=Z0*(1./Y1+1j*Z0.*tan(2*pi*D_TL_shunt_doublestub*f/f0)) ...
./(Z0+1j*1./Y1.*tan(2*pi*D_TL_shunt_doublestub*f/f0));
Z_stb2_sc=Z0*1j*tan(2*pi*(D21stub_sc_shunt_doublestub)*f/f0); % sc
Zin=1./(1./ZinTL+1./Z_stb2_sc);
s11=[s11_mod;(Zin-Z0)./(Zin+Z0)];
s11_mod=[s11_mod;abs((Zin-Z0)./(Zin+Z0))];

Zin_stb1_sc=Z0*1j*tan(2*pi*(D12stub_sc_shunt_doublestub)*f/f0); % sc
Y1=YL+1./Zin_stb1_sc;
ZinTL=Z0*(1./Y1+1j*Z0.*tan(2*pi*D_TL_shunt_doublestub*f/f0)) ...
./(Z0+1j*1./Y1.*tan(2*pi*D_TL_shunt_doublestub*f/f0));
Z_stb2_sc=Z0*1j*tan(2*pi*(D22stub_sc_shunt_doublestub)*f/f0); % sc
Zin=1./(1./ZinTL+1./Z_stb2_sc);
s11=[s11_mod;(Zin-Z0)./(Zin+Z0)];
s11_mod=[s11_mod;abs((Zin-Z0)./(Zin+Z0))];

Zin_stb1_oc=Z0./(1j*tan(2*pi*(D11stub_oc_shunt_doublestub)*f/f0)); % oc
Y1=YL+1./Zin_stb1_oc;
ZinTL=Z0*(1./Y1+1j*Z0.*tan(2*pi*D_TL_shunt_doublestub*f/f0)) ...
./(Z0+1j*1./Y1.*tan(2*pi*D_TL_shunt_doublestub*f/f0));
Z_stb2_oc=Z0./(1j*tan(2*pi*(D21stub_oc_shunt_doublestub)*f/f0)); % oc
Zin=1./(1./ZinTL+1./Z_stb2_oc);
s11=[s11_mod;(Zin-Z0)./(Zin+Z0)];
s11_mod=[s11_mod;abs((Zin-Z0)./(Zin+Z0))];

Zin_stb1_oc=Z0./(1j*tan(2*pi*(D12stub_oc_shunt_doublestub)*f/f0)); % oc
Y1=YL+1./Zin_stb1_oc;
ZinTL=Z0*(1./Y1+1j*Z0.*tan(2*pi*D_TL_shunt_doublestub*f/f0)) ...
./(Z0+1j*1./Y1.*tan(2*pi*D_TL_shunt_doublestub*f/f0));
Z_stb2_oc=Z0./(1j*tan(2*pi*(D22stub_oc_shunt_doublestub)*f/f0)); % oc
Zin=1./(1./ZinTL+1./Z_stb2_oc);
s11=[s11_mod;(Zin-Z0)./(Zin+Z0)];
s11_mod=[s11_mod;abs((Zin-Z0)./(Zin+Z0))];

s11_mod(1,:)=[];s11(1,:)=[];

for k=1:1:size(s11_mod,1)
figure(1);plot(f,s11_mod(k,:));hold all;
end
grid on
title('short/open shunt double stub |s11|')
legend('D11sc D21sc','D12sc D22sc','D11oc D21oc', …
'D12oc D22oc','Location','northwest')

for k=1:1:size(s11_mod,1)
figure(2);plot(f,10*log10(s11_mod(k,:)));axis([1e9 3e9 -35 0]);hold all;
end
grid on;grid minor
title('short/open shunt double stub 10 log|s11|')
legend('D11sc D21sc','D12sc D22sc','D11oc D21oc', …
'D12oc D22oc','Location','northwest')

for k=1:1:size(s11_mod,1)
figure(3);plot(f,20*log10(s11_mod(k,:)));axis([1.7e9 2.3e9 -20 -10]);hold all;
end
grid on;grid minor
title('20dB Return Loss BW for short/open shunt double stub')
legend('D11sc D21sc','D12sc D22sc','D11oc D21oc', ...
D12oc D22oc','Location','northwest')

_________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com 9 / 11
MICROWAVE ENGINEERING – POZAR – IMPEDANCE MATCHING CHAPTER 05 EXERCISE 12 07/10/2018 04:54:15.

2 stubs improves BW, smaller amount of trace points below -20dB compared to
traces from single stubs matching.

## % plotting trace points below -20dB

a=10*log10(s11_mod(1,:))
a_below20=a(a<-20)
[nx,f_below20]=find(a<-20)
f_bw=f(f_below20)
figure(2);plot(f_bw,a_below20,'bo')

BW_band_RL20dB_doubleshuntstub=[0 0];
BW_RL20dB_doubleshuntstub=0;

## % measuring all bandwidths

for k=1:1:size(s11_mod,1)
a=10*log10(s11_mod(k,:));
a_below20=a(a<-20);
[nx,f_below20]=find(a<-20);
f_bw=f(f_below20);
% figure(2);plot(f_bw,a_below20,'bo')
BW_band_RL20dB_doubleshuntstub=...
[BW_band_RL20dB_doubleshuntstub;min(f_bw) max(f_bw)];
BW_RL20dB_doubleshuntstub=...
[BW_RL20dB_doubleshuntstub;abs(min(f_bw)-max(f_bw))];
end BW_band_RL20dB_doubleshuntstub =
1.0e+09 *
BW_band_RL20dB_doubleshuntstub(1,:)=[]; 0 0
BW_RL20dB_doubleshuntstub(1)=[]; 1.999200000000000 2.000800000000000
1.992800000000000 2.007200000000000
BW_band_RL20dB_doubleshuntstub 1.998400000000000 2.001600000000000
BW_RL20dB_doubleshuntstub 1.991500000000000 2.008700000000000

% storing BW_RL20dB_doubleshuntstub =
save('pozar_05_12_vars.mat',... 0
'BW_band_RL20dB_doubleshuntstub','BW_RL20dB_doubleshuntstub') 1600000
14400000
3200000
17200000

calculations)

## since there is only one stub length for

each stub this simplifies calculations and
graphs.

ZL=200;Z0=100;Y0=1/Z0;YL=1/ZL;GL=real(YL);BL=imag(YL);XL=imag(ZL);GL=real(YL);BL=imag(YL);
c=3e8;f0=2e9;df=1e5;f1=1e9;f2=3e9;f=[f1:df:f2];

s11=zeros(1,numel(f));s11_mod=zeros(1,numel(f));

## Zin_stb1_sc=Z0*1j*tan(2*pi*(D11stub_sc_series_doublestub)*f/f0); % short circuit stub

Z1=ZL+Zin_stb1_sc;
ZinTL=Z0*(Z1+1j*Z0.*tan(2*pi*D_TL_series_doublestub*f/f0))...
./(Z0+1j*Z1.*tan(2*pi*D_TL_series_doublestub*f/f0));
Z_stb2_sc=Z0*1j*tan(2*pi*(D22stub_sc_series_doublestub)*f/f0); % sc
Zin=ZinTL+Z_stb2_sc;s11=[s11_mod;(Zin-Z0)./(Zin+Z0)];

_________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com 10 / 11
MICROWAVE ENGINEERING – POZAR – IMPEDANCE MATCHING CHAPTER 05 EXERCISE 12 07/10/2018 04:54:15.

s11_mod=[s11_mod;abs((Zin-Z0)./(Zin+Z0))];

s11_mod(1,:)=[];s11(1,:)=[];
for k=1:1:size(s11_mod,1)
figure(1);plot(f,s11_mod(k,:));hold all;
end
grid on
title('short/open series double stub |s11|')
legend('D11sc D21sc','D12sc D22sc','D11oc D21oc','D12oc D22oc','Location','northwest')

for k=1:1:size(s11_mod,1)
figure(2);plot(f,10*log10(s11_mod(k,:)));axis([1e9 3e9 -35 0]);hold all;
end
grid on;grid minor
title('short/open series double stub 10 log|s11|')
legend('D11sc D21sc','D12sc D22sc','D11oc D21oc','D12oc D22oc','Location','northwest')

for k=1:1:size(s11_mod,1)
figure(3);plot(f,20*log10(s11_mod(k,:)));axis([1.7e9 2.3e9 -20 -10]);hold all;
end
grid on;grid minor
title('20dB Return Loss BW for short/open series double stub')
legend('D11sc D21sc','D12sc D22sc','D11oc D21oc','D12oc D22oc','Location','northwest')

## % plotting trace points below -20dB

a=10*log10(s11_mod(1,:))
a_below20=a(a<-20)
[nx,f_below20]=find(a<-20)
f_bw=f(f_below20)
figure(2);plot(f_bw,a_below20,'bo')

BW_band_RL20dB_doubleseriestub=[0 0];BW_RL20dB_doubleseriestub=0;
% measuring all bandwidths and storing
for k=1:1:size(s11_mod,1)
a=10*log10(s11_mod(k,:));
a_below20=a(a<-20);
[nx,f_below20]=find(a<-20);
f_bw=f(f_below20);
% figure(2);plot(f_bw,a_below20,'bo')
BW_band_RL20dB_doubleseriestub=[BW_band_RL20dB_doubleseriestub;min(f_bw) max(f_bw)];
BW_RL20dB_doubleseriestub=[BW_RL20dB_doubleseriestub;abs(min(f_bw)-max(f_bw))];
end
BW_band_RL20dB_doubleseriestub(1,:)=[];BW_RL20dB_doubleseriestub(1)=[];

BW_band_RL20dB_doubleseriestub BW_band_RL20dB_doubleseriestub =
BW_RL20dB_doubleseriestub
1.0e+09 *
save('pozar_05_12_vars.mat','BW_band_RL20dB_doubleseriestub','BW_RL20dB_doubleseriestub') 1.981800000000000
2.017700000000000

BW_RL20dB_doubleseriestub =
35900000

It has already been shown that there are more matching combinations of shunt series open and short circuit stub than the ones shown in this exercise.
And this wth passive components only, there are even more possibilities when using active components.

_________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com 11 / 11