exercise 5.21
ZIP with MATLAB scripts and note:
exercise 5.21 notes:
ZL/Z0=1.5
gamma=A*(1+(cos(theta))^2) theta within [0 pi]
N=2
Z0=50;ZL=75;
ZL_ov_Z0=ZL/Z0 % =1.5;
gamma0=(ZL_ov_Z0-1)/(ZL_ov_Z0+1)
% solving A value
syms A theta
g=A*(.1+(cos(theta))^2)
g0=subs(g,theta,0)
eq1=g0==gamma0
A0=double(solve(eq1,A))
% plotting gamma_in(theta)
theta=[0:.001:pi];
gamma_in=A0*(.1+(cos(theta))^2);
figure(1);plot(theta,abs(gamma_in));grid on;
axis([0 pi 0 A0*1.3]);
why Cheby transformer cannot solve this exercise
syms x;chebyshevT(N,x)
SWR_f0=(1+gamma0)./(1-gamma0)
% g and Zr ordered generator to load
[g,Zr_50to75]=Cheby_Ztransformer(50,75,SWR_f0,N);
g
Zr_50to75
1st the 2 characteristic impedances are really close
values, 61.19 61.27
only one section is required
2nd Cheby always adds zeros in the reflection coefficient within the pass band the question template shows there's requirement for not a single zero in [0 pi]:
A*(.1+(cos(theta))^2)=A*(.6+.5*cos(2*theta))==...
2*(g0*cos(2*theta)+.5*g1)
syms g0 g1
eq1=A0*.6==.5*g1;eq2=A0*.5==2*g0;
solve([eq1 eq2],[g0 g1])
g0=double(y.g0)
g1=double(y.g1)
g=[g1 g0]
Zr=ZL
for k=2:1:numel(g)
Zr=[Zr Zr(k-1)*(1+g(k-1))/(1-g(k-1))]
end
gamma_L=(ZL_ov_Z0-1)/(ZL_ov_Z0+1);
gamma_m=A0*.1
SWR=(1-gamma_m)/(1-gamma_m)
BLm=asec(cosh(1/N*acosh(1/gamma_m*abs(gamma_L))))
% fractional bandwidth, not applying octave up octave down, but f0+df/2 f0-df/2
df_ov_f0=2-4*BLm/pi
D=[0:.001:.5];N0=[N:-2:0]'
g0=zeros(1,numel(D));s=floor((N+1)/2+.5)
d=1;
g0=zeros(1,numel(D));
for k=N:-2:0
L=g(d)*cos(k*2*pi*D);
g0=g0+L;
d=d+1;
end
g0=2*exp(-1j*N*2*pi*D).*g0;
figure(2);plot(D,abs(g0));grid on;hold all
plot([.25-.25*df_ov_f0/2 .25+.25*df_ov_f0/2 ...
.25+.25*df_ov_f0/2 .25-.25*df_ov_f0/2 ...
.25-.25*df_ov_f0/2],[0 0 A0 A0 0],'r');
title('|s11|')
vswr=(1+abs(g0))./(1-abs(g0))
figure(3);plot(D,vswr);grid on;hold all
plot([.25-.25*df_ov_f0/2 .25+.25*df_ov_f0/2 ...
.25+.25*df_ov_f0/2 .25-.25*df_ov_f0/2 ...
.25-.25*df_ov_f0/2],[1 1 SWR_f0 SWR_f0 1],'r');
title('SWR')
check:
Zr(2)^2/75 = 51.800052907199998
Zr(1)^2/(Zr(2)^2/75) = 48.394248857833908
Zr(1)^2/(Zr(2)^2/75)/Z0 = 0.966566580341093
= 2*x^2 - 1
SWR_f0 = 1.5000
g = 0.100683138513521 0.000683138513521 0.100683138513521
Zr = 61.195335394729334 61.27900233174827 75.000000000000000
g0 = 0.027777777777778
g1 = 0.133333333333333
g = 0.109090909090909 0.045454545454545
Zr = 50.068199999999997 62.329799999999999
Cheby_Ztransformer.m
function [g,Zr]=Cheby_Ztransformer(Z0in,ZLin,SWR,N)
% single freq chebyshev impedance transformer with N ;lambda/4 ideal transmission line sections
% Zr: characteristic impedance of each section of transformer
% g reflection input of each section
% script author: John Bofarull Guix
% Z0in=50;ZLin=100 % test inputs
% SWR=1.25 % max SWR
% N=4; % N amount lambda/4 sections to insert between Z0 and ZL
%%% Input Checks %%%%%%%%%%%%%%%%
if numel(ZLin)>1 || numel(Z0in)>1 % ZLin Z0in scalars only
sprintf('ZLin Z0in scalars only.\n');return;
end
if Z0in==ZLin % input check:ZLin,Z0in!=0
sprintf('ZLin Z0in must be different.\n');return;
end
if imag(ZLin)~=0 || imag(Z0in)~=0 % input check: imag ZLin,Z0in =0
sprintf('ZLin Z) reals only. \n');return;
end
if ZLin>Z0in % the table generated following POZAR pg 260 only applies to ZL>Z0
Z0=Z0in;ZL=ZLin;
reverse=0; % reverse=0 ZL/Z0>1
else
Z0=ZLin;ZL=Z0in;
reverse=1; % reverse=1 ZL/Z0<1
end
%%%%%%%%%%%%%
ZL_ov_Z0=ZL/Z0; % ZL/Z0>0 only
syms x y;
tn=chebyshevT(N,x)
tn_coeffs=coeffs(tn,'All');tn_coeffs=double(tn_coeffs([end:-1:1])) % most significant poly term is 1
tn_coeffs=tn_coeffs([end:-1:1]); % least significant poly term is 1
tn_coeffs=nonzeros(tn_coeffs)'; % cosine power expansion either take all even or all odd terms only
fplot(tn,'b');axis([-1.2 1.2 -1.2 5]);grid on
hold all;plot([-1 1 1 -1 -1],[-1 -1 1 1 -1],'r') % band pass red rectangle
gamma_L=(ZL-Z0)/(ZL+Z0) % reflection that would be without impedance transformer
gamma_m=(SWR-1)/(SWR+1) % worst allowed reflection within pass band
A=gamma_m % Cheby polys always catch max reflection at both edges of band
% BLm=asec(cosh(1/N*acosh(1/gamma_m*abs(gamma_L))))
BLm=asec(cosh(1/N*acosh(abs(log(ZL/Z0)/(2*gamma_m)))))
BLm_degree=BLm*180/pi
a=sec(BLm) % = sec(theta_m)
remN2=rem(N,2);k=1;p={} % generating matrix p to equate cheby coeffs to cos power expansions
for N0=[N:-2:0]
switch remN2
case 0
n=N0/2;
K1=[0:1:n-1]; N1=N0*ones(1,numel(K1));
p=[p; tn_coeffs(k)*[1/2^(N0-1)*arrayfun(@(a,b) nchoosek(a,b),N1,K1) 1/2^N0*nchoosek(N0,n) ]]
k=k+1;
otherwise
n=(N0-1)/2;
K1=[0:1:n]; N1=N0*ones(1,numel(K1));
p=[p; 1/4^n*tn_coeffs(k)*[ arrayfun(@(a,b) nchoosek(a,b),N1,K1) ]]
k=k+1;
end
end
p2=zeros(max(size(p)))
for k=1:1:max(size(p))
L=p{k}
p2([numel(L):-1:1],k)=L;
end
p2=flip(p2)
g=sum(repmat(A/2*a.^[N:-2:0],max(size(p)),1).*p2,2)' % generating 1st half reflection coefficients
if mod(numel(g),2)~=0 % correcting DC for even exponent, ene N cos power expansions with DC term
g(end)=2*g(end);
end
gplot=g; % use exact method for SWR plot
% g3=[zeros(1,N+1-numel(g)) flip(g)] % generating remaining reflection coefficients
g3=[zeros(1,N+1-numel(g)) g]
g3([1:N+1-numel(g)])=g([1:N+1-numel(g)])
g=g3;
Zr=zeros(1,numel(g))
if (~reverse) % exact calculation
Zr(1)=ZL;
for k=2:1:numel(g)
Zr(k)=Zr(k-1)/((1+g(k-1))/(1-g(k-1)));
end
Zr=flip(Zr)
elseif (reverse) % reverse=0
Zr(1)=ZL;
for k=2:1:numel(g)
Zr(k)=Zr(k-1)*(1+g(k-1))/(1-g(k-1));
end
Zr=flip(Zr)
end
% if (~reverse) % approximate
% Zr(1)=ZL;
% for k=2:1:numel(g)
% Zr(k)=exp(log(Zr(k-1))-2*g(k-1));
% end
% Zr=flip(Zr)
% elseif (reverse) % ZL<Z0
% Zr(1)=ZL;
% for k=2:1:numel(g)
% Zr(k)=exp(log(Zr(k-1))+2*g(k-1));
% end
% Zr=flip(Zr)
% end
Zr
Zr/Z0
k2=1; % generating variables for reflection coefficients of transformer
for s=0:1:size(g,2)-1
str1=['g' num2str(s) '=' num2str(g(k2)) ];
evalin('base',str1);
k2=k2+1;
end
for s=1:1:size(Zr,2) % generating variables for characteristic impedances of transformer
str1=['Z' num2str(s-1) '=' num2str(Zr(s)) ];
evalin('base',str1);
% k2=k2+1;
end
end