You are on page 1of 21

POZAR chapter 02 Transmission Line Basics: Example 03 16/04/2023 11:45:45.

EXAMPLE 2.3
Click any to open the MATLAB script solving this exercise. Run script to read question and calculate solution.
On 1st run, the exercise is solved and results are stored in .mat file. Parameters can be modified to solve exercise
variations. MATLAB student licences are free for students in university or college, toolboxes upgrades are cheap
and there is a licence type that does not even require to be registered in any learning institution.

To download and install MATLAB as well as review help on specific commands click any MATLAB icon:

Document author: John Bofarull Guix jgb2012@sky.com jgb2014@live.co.uk https://jgb2012.wixsite.com/microwave-eng-matlab

Download .mlx

Smith Chart Operations 02: find input and load admittances

Contents

1.- Place Load Impedance ZL on Smith Chart


2.- Calculate Load Admittance YL
3.- Rotate .15*lambda Towards Generator
4.- Input Admittance
5.- Load Single Frequency with R L
6.- Test with the Quite Universal Circuit Simulator Produces Errors
7.- QUCSTUDIO Simulator Works OK

8.- Introduction to transmissionLineDesigner

9.- Previous Round


10.- Smith Chart Support Functions for example 2.3
10.1.- Smith_pinZ
10.2.- Smith_swrCircle
10.3.- Smith_swrArc

Comments and References

______________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com mailto:jgb2014@live.co.ukailto: attached: all 1 / 21
POZAR chapter 02 Transmission Line Basics: Example 03 16/04/2023 11:45:45.

pozar_02_example_03.m

c0=physconst('Lightspeed'); % [m/s]
Z0=50; % [ohm] TL
ZL=100+1j*50; % [ohm] load

f0=1e10 % [Hz] carrier frequency


lambda0=c0/f0 % [m] wavelength
D=.15 % TL relative wavelength
L=D*lambda0 % TL physical length

% start blank Smith Chart


hf1=figure
ax=gca
sm1=smithplot;
hold all

% Smith Chart Configuration


sm1.ClipData=0;
sm1.GridType='ZY';
sm1.FontName='Tahoma';
sm1.FontSize=11;
sm1.TitleTopFontWeight='normal';
sm1.GridForegroundColor=[.7 .7 .7];
sm1.TitleTopTextInterpreter='tex'; % ['none' 'tex' 'latex']
sm1.TitleTop=[ num2str(D) '*\lambda rotation Z_{L} to Z_{in} Clock Wise'];
sm1.TitleBottomTextInterpreter='tex'; % [none 'tex' 'latex']
sm1.TitleBottom=['Z_{0} = ' num2str(Z0) ' \Omega Smith Chart Type : ' sm1.GridType];
sm1.TitleBottomOffset=.2; % <.5
sm1.GridSubLineWidth=1;
sm1.GridVisible='1';
sm1.ArcTickLabelVisible=0;
sm1.CircleTickLabelVisible=0;
sm1.NextPlot='add';

% a bit of visual reference for angles


d1=1;d2=1.12;
plot(ax,d1*cos([0:.1:2*pi+.1]),d1*sin([0:.1:2*pi+.1]),'Color',[.6 .6 .6]);
plot(ax,d2*cos([0:.1:2*pi+.1]),d2*sin([0:.1:2*pi+.1]),'Color',[.6 .6 .6]);
v=[0:1/24:1]*2*pi;
for k=1:1:numel(v)
plot(ax,[d1 d2]*cos(v(k)),[d1 d2]*sin(v(k)),'Color',[.6 .6 .6]);
end

______________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com mailto:jgb2014@live.co.ukailto: attached: all 2 / 21
POZAR chapter 02 Transmission Line Basics: Example 03 16/04/2023 11:45:45.

1.- Place Load Impedance ZL on Smith Chart

c=[1 0 0];
% load reflection coefficient
[rLza rLzm]=Smith_pinZ(ax,ZL,Z0,[1 0 0],0)
[rLzx,rLzy]=pol2cart(rLza,rLzm);0
text(ax,rLzx+.2,rLzy+.05,'zL',...
'Color',[.7 0 0],...
'FontSize',15,...
'HorizontalAlignment','right',...
'VerticalAlignment','middle');

% SWR full circle


[rx,ry]=Smith_swrCircle(ax,ZL,Z0,[.5 0 .5]);

2.- Calculate Load Admittance YL

% Load Admittance expected value


YL=1/ZL

% a: arc on Smith Chart


a=D*2*pi/.5 % .5*lambda=2*pi rad on Smith Chart

% admittance on Y Smith Chart


[rLya rLym]=Smith_pinZ(ax,YL,1/Z0,[1 0 0],0)
[rLyx,rLyy]=pol2cart(rLya,rLym);

text(ax,rLyx-.05,rLyy+.05,'yL',...
'Color',[.7 0 0],...
'FontSize',15,...
'HorizontalAlignment','right',...
'VerticalAlignment','middle');

= 3.6052 0.4472 % reflection coeff of YL in polar

= -0.4000 -0.2000 % reflection coeff of YL in cart

% angle visual reference


plot(ax,[cos(angle((rLzx(end)+1j*rLzy(end)))) cos(angle((rLyx(end)+1j*rLyy(end))))],...
[sin(angle((rLzx(end)+1j*rLzy(end)))) sin(angle((rLyx(end)+1j*rLyy(end))))],'Color',[0 1 1]);
plot(ax,[rLzx rLyx],[rLzy rLyy],'Color',[0 .7 .0]); % line zL to yL
gammayL=rLyx+1j*rLyy
% load admittance obtained with Smith Chart rotation
YL_sc=1/Z0*(1+gammayL)/(1-gammayL)

______________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com mailto:jgb2014@live.co.ukailto: attached: all 3 / 21
POZAR chapter 02 Transmission Line Basics: Example 03 16/04/2023 11:45:45.

3.- Rotate .15*lambda Towards Generator

% Load-to-Generator, Z Smith Chart : RL=-1 (CW)


% Load-to-Generator, Y Smith Chart : ALSO RL=-1 (CW)

% EITHER shift arc a CW from ZL to find Zin


RL=-1
c=[1 0 0]

[r2x,r2y]=Smith_swrArc(ax,ZL,Z0,a,RL,c);

plot(ax,r2x(end),r2y(end),'ro') % marker zin


text(ax,r2x(end)+.1,r2y(end)-.1,'zin',...
'Color',[.7 0 0],...
'FontSize',15,...
'HorizontalAlignment','right',...
'VerticalAlignment','middle');

gammazin=r2x(end)+1j*r2y(end);

Zin_sc=Z0*(1+gammazin)/(1-gammazin)

Yin_check=1/Zin_sc

gammazin =
0.0666 - 0.4422i
Zin_sc =
37.4972 -41.4553i
Yin_check =
0.0120 + 0.0133i

4.- Input Admittance

% OR shift same arc ALSO CW from YL to find Yin

[riyx,riyy]=Smith_swrArc(ax,YL,1/Z0,a,RL,[0 0 1]);

plot(ax,riyx(end),riyy(end),'ro') % marker yin


text(ax,riyx(end)-.05,riyy(end)+.1,'yin',...
'Color',[.7 0 0],...
'FontSize',15,...
'HorizontalAlignment','right',...
'VerticalAlignment','middle');

______________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com mailto:jgb2014@live.co.ukailto: attached: all 4 / 21
POZAR chapter 02 Transmission Line Basics: Example 03 16/04/2023 11:45:45.

% angle visual reference


plot(ax,[cos(angle((riyx(end)+1j*riyy(end)))) cos(angle((r2x(end)+1j*r2y(end))))],...
[sin(angle((riyx(end)+1j*riyy(end)))) sin(angle((r2x(end)+1j*r2y(end))))],'Color',[0 1 1]);
plot(ax,[riyx(end) r2x(end)],[riyy(end) r2y(end)],'Color',[0 .7 0]); % line yin zin

gammayin=riyx(end)+1j*riyy(end);

% this is Yin
Yin_sc=1/Z0*(1+gammayin)/(1-gammayin) Yin_sc =
0.0120 + 0.0133i
% and this Zin
Zin_check=1/(1/Z0*(1+gammayin)/(1-gammayin)) Zin_check =
37.4956 -41.4539i

Zin=Z0*(ZL+1j*Z0*tan(2*pi*D))/(Z0+1j*ZL*tan(2*pi*D)) Zin =
37.4956 -41.4539i

Yin=1/Zin Yin =
0.0120 + 0.0133i

All values calculated directly match to those graphically obtained on Smith Chart.

5.- Load single frequency with R L

syms R positive real;


syms L positive real;
f0=1e9
Z0=50
ZL=100+1j*50
eqns=[real(ZL)-real(R+1j*L*2*pi*f0)==0, ...
imag(ZL)-imag(R+1j*L*2*pi*f0)==0];
vars=[R L]; R1 =
[solR solL]=solve(eqns,vars); 100
R1=eval(solR) L1 =
L1=eval(solL) 7.9577e-09
% check =
R1+1j*L1*2*pi*f0 1.0000e+02 + 5.0000e+01i

In next point, same circuit with QUCS.

______________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com mailto:jgb2014@live.co.ukailto: attached: all 5 / 21
POZAR chapter 02 Transmission Line Basics: Example 03 16/04/2023 11:45:45.

6.- Test with the Quite Universal Circuit Simulator Produces Errors

Details how to install and available workbook link in [1]. Using version 0.0.19. 1st contact:

example_02_03_02.sch

As wavelength fractions electric lengths have no dimension.

At f0 the right value shows up:

Note that the above S[1,1] arc in red on Smith Chart shows
the correct load ZL at 1GHz, but the arc is not an SWR circle.
It's a frequency sweep.

(ZL-Z0)/(ZL+Z0) = 0.4000 + 0.2000i


[rcheck,acheck]=cart2pol(.4,.2) = 0.4636
= 0.4472
acheck_deg=acheck*180/pi = 25.6235
abs(.448-.4472)/.448*100 % module error = 0.1786
abs(acheck_deg-24.1)/acheck_deg*100 % angle error = 5.9455

______________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com mailto:jgb2014@live.co.ukailto: attached: all 6 / 21
POZAR chapter 02 Transmission Line Basics: Example 03 16/04/2023 11:45:45.

example_02_03_03.sch

When a component
value sweep is
attempted on a single
frequency, at least as
follows, the simulation
produces no errors, but
no results are plotted on
the Smith Chart either. I
tried both single port, 2
ports, and with and AC
simulation block.

The obtained S[1,1] S[2,1]


on the right hand side table
do not correspond to the
actual circuit, indicating
that when a single
frequency is used in
S parameter simulation,
the simulation does not
really take place.

example_02_03_04.sch

Now it's still a frequency sweep, but the red arcs


shapes are closer to a SWR.

Reducing the frequency sweep as much as


possible:

______________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com mailto:jgb2014@live.co.ukailto: attached: all 7 / 21
POZAR chapter 02 Transmission Line Basics: Example 03 16/04/2023 11:45:45.

And despite we have


swept the electrical
length of the
transmission line over
a narrow frequency
range, the produced
circle is wider than the
expected SWR.

On the left the expect


correct result. The
SWR circle has to have
a shorter radius.

example_02_03_08.sch

The resulting Zin is not correct: (.443+1j*.627)/(.00379-1j*.00126) = 5.5728e+01 + 1.8396e+02i

______________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com mailto:jgb2014@live.co.ukailto: attached: all 8 / 21
POZAR chapter 02 Transmission Line Basics: Example 03 16/04/2023 11:45:45.

example_02_03_05.sch

I actually would put the 2nd port in


parallel to the load, but again the
obtained SWR does have the correct
radius, now the SWR circle is too
small.

Also, in this circuit, when asking for


S[2,2] nothing is plotted. It's not that
S[2,2] is hidden behind S[1,1].

Even when just S[2,2] then no trace


is plotted.

It seems as if this simulator is a work


in progress, and RF simulation still
has limitations and errors to be
solved.

example_02_03_09.sch

The Smith Chart interface seems to allow


dimensionless transmission line values to be used,
but QUCSTUDIO only has transmission lines with
physical dimensions, so just in case, I try
.15*c0/f0=.0045 meters instead:

And anow QUCS is impervious to the presence of


the coil in the load; S[1,1] shows up as if there
were no inductance at all in the load:

QUCS cursors, aka trace markers or data tips do


not 'glide' on traces, which would be very useful, so
one has to guess and keep placing static markers
until on right frequency.

QUCS has a transmission line called 4-Port Line


that it's actually 2 port, not 4. QUCS mixes 'port'
with 'pin' or 'terminal'.

List of QUCS built-in examples in [2].

______________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com mailto:jgb2014@live.co.ukailto: attached: all 9 / 21
POZAR chapter 02 Transmission Line Basics: Example 03 16/04/2023 11:45:45.

7.- QUCSTUDIO Simulator Works OK

There is another simulator named QUCSSTUDIO [3] that produces correct result on 1st round. List of QUCSTUDIO available
examples in [4].

I use the same icon for QUCS and QUCSTUDIO circuits but QUCSTUDIO does not open QUCS circuits and I may know why.

ucs_02_01.sch

55.8*(cos(pi/180*(-47.9))+1j*sin(pi/180*(-47.9))) = 37.4098 -41.4023i

Right on spot real(Zin) error below 0.01.

S Parameter sweep
between .5GHz and
1.5GHz with 101 points.

QUCSTUDIO markers
nicely glide on traces.

______________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com mailto:jgb2014@live.co.ukailto: attached: all 10 / 21
POZAR chapter 02 Transmission Line Basics: Example 03 16/04/2023 11:45:45.

And because it's a passive network, one expects S


symmetrical, S[2,1]=S[1,2] but this does not imply
S[1,1]=S[2,2], which is another problem with
QUCS on this circuit, but QUCSTUDIO solves again
this point correctly.

8.- Introduction to transmissionLineDesigner

______________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com mailto:jgb2014@live.co.ukailto: attached: all 11 / 21
POZAR chapter 02 Transmission Line Basics: Example 03 16/04/2023 11:45:45.

With the default ground width the resulting Z0 is %% TransmissionLineProperties


60. Double the ground width and the correct txLineObj = microstripLineCustom;
Z0=50 is then produced. txLineObj.TraceLength = 0.0581926766532197 ;
txLineObj.TraceWidth = 0.0015 ;
txLineObj.GroundPlaneLength = 0.012 ;
transmissionLineDesigner generates code to
txLineObj.LeftCoupledTraceGap = 0 ;
build this transmission line and apply changes txLineObj.RightCoupledTraceGap = 0 ;
directly on txLineObj fields. % Substrate Properties
txLineObj.Substrate.Name = {'TMM10i'} ;
txLineObj.Substrate.EpsilonR = 9.9 ;
txLineObj.Substrate.LossTangent = 0.002 ;
% Conductor Properties
txLineObj.Conductor.Name = {'Copper'} ;
txLineObj.Conductor.Conductivity = 59600000 ;
txLineObj.Conductor.Thickness = 3.556e-05 ;
% Show Transmission Line
figure('Name','TransmissionLine');
show(txLineObj);
%% RLGC Values
% Design Frequency for RLGC Analysis
Frequency = 1.00e+09;
% Calculate RLGC Values
RLGC = rlgc(txLineObj,Frequency);
% Calculate Propagation Delay
PropagationDelay = propagationDelay(txLineObj,Frequency);
% Calculate Characteristic Impedance
CharacteristicImpedance = sqrt(RLGC.L(1,1)/RLGC.C(1,1));

5.- Previous Round

previous_02_example_03.m

Following the previous solution, without Smith Chart support functions. Same correct results obtained.

TL is 0.15 long Z0=50; ZL=100+j50 . Find Y_load and Y_in

close all;clear all;clc


format long;
sm1=smithplot;
sm1.GridType='ZY';
% inputs:
Z0=50;ZL=100+1j*50;
% Find YL and Yin moving 0.15*lambda towards generator
gamma=z2gamma(ZL,Z0) % without specifying Z0, z2gamma takes Z0=50 as default
gamma= (ZL-Z0)/(ZL+Z0)

if imag(ZL)<0
sign1='-'
else
sign1='+'
end
hold all;plot(real(gamma),imag(gamma),'ro','LineWidth',1.5)
str1=['ZL =' num2str(real(ZL)) sign1 'j' num2str(abs(imag(ZL))) ' \rightarrow'];
text(real(gamma),imag(gamma)+.01,str1,'Color','blue','FontSize',20,'HorizontalAlignment','right','VerticalAlignment','middle')
r=abs(gamma)
SWR=(1+r)/(1-r)
______________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com mailto:jgb2014@live.co.ukailto: attached: all 12 / 21
POZAR chapter 02 Transmission Line Basics: Example 03 16/04/2023 11:45:45.

RL=-20*log10(r)

% sm1=smithchart(gamma) plots absolutely nothing


alpha=0:2*pi/100:2*pi;
hold all
plot(r*cos(alpha),r*sin(alpha),'LineWidth',1.5,'Color','blue')
L0=gamma/abs(gamma)
plot([0 real(L0)],[0 imag(L0)],'g','LineWidth',1.5)

% moving 0.3&lambda towards generator


% lambda/4 is equivalent to rotation along half Smith Chart, this is: 180º
% moving lambda/4 towards generator would be
% L1=L0*exp((0+1j)*pi)
% plot([0 real(L1)],[0 imag(L1)],'Color',[0 0.7 0],'LineWidth',1.5)

% problem input 3: towards generator


a2=(.15/.25)*pi
L2=L0*exp(-(0+1j)*a2)
plot([0 real(L2)],[0 imag(L2)],'Color',[0 0.7 0],'LineWidth',1.5)
gamma_in=L2*r
Zin=gamma2z(gamma_in,Z0)
% z_in = 36.533960924745216 -61.118970709646213i
% equivalent to
% Z0*(1+L2*r)/(1-L2*r) = 36.533960924745216 -61.118970709646213i
plot(real(gamma_in),imag(gamma_in),'ro','LineWidth',1.5)
if imag(Zin)<0
sign1='-'
else
sign1='+'
end
% just for display purposes, keeping only 2 decimals, Zin not rounded
str_Zinreal=num2str(real(Zin));str_Zinimag=num2str(abs(imag(Zin)));
str_Zinreal([find(str_Zinreal=='.')+3:end])=[];str_Zinimag([find(str_Zinimag=='.')+3:end])=[];
str1=['Zin =' str_Zinreal sign1 'j' str_Zinimag ' \rightarrow'];
text(real(gamma_in),imag(gamma_in)+.01,str1,'Color','blue','FontSize',20,'HorizontalAlignment','right','VerticalAlignment','middle')
Yin=1/Zin

______________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com mailto:jgb2014@live.co.ukailto: attached: all 13 / 21
POZAR chapter 02 Transmission Line Basics: Example 03 16/04/2023 11:45:45.

7.- Smith Chart Support Functions for example 2.3

7.1.- Smith_pinZ

Smith_pinZ(ax,Z,Z0,c,s)

function [gamma_Z_angle,gamma_Z_mod]=Smith_pinZ(ax,Z,Z0,c,s)
% SMITH_PINZ : Support function for Smith Chart operations.
%
% SMITH_PINZ plots on Z Smith Chart the reflection coefficient of input impedance Z.
%
% Before calling SMITH_PINZ open blank Smith Chart with for instance the
% following commands:
% fh=figure
% ax=gca
% sm1=smithplot
%
% INPUT FIELDS:
%
% ax : graphics handle of figure containing Smith Chart generated with smithplot.
% always required to avoid sending the marker plotting to different figure.
%
% Z : [ohm] single value, input impedance R+1j*X, do not normalise values.
%
% Z0 : [ohm] single value, Transmission Line characteristic impedance.
%
% c : [R G B] 0 to 1 range colour definition for Marker edge plotted showing Z position.
% 0:white 1:black
%
% s : [0 1] switch to print ZL=R+jX : s=1 text showing 'ZL=R+jX' values is added.
% s=0 output NO text showing ZL=R+jX data is added.
% any other value of s pops error message on command prompt and null
%
% OUTPUT FIELDS:
% gamma_Z_angle, gamma_Z_mod: reflection coefficient is complex and carteisan real(refl) + 1j*imag(refl) format
%
% angles sign, same angle for instance -60º can also show
% up as 300º, can be avoided when only using positive angles, for all angles.
%
% there have to be exactly 5 inputs and exactly 1 complex output
%
% Author: John Bofarull Guix
% contact: jgb2012@sky.com jgb2014@live.co.uk
%

gamma_Z=z2gamma(Z,Z0); % refl=(ZL-Z0)/(ZL+Z0)

gamma_Z_angle=angle(gamma_Z);
gamma_Z_mod=abs(gamma_Z);

if gamma_Z_angle<0 % removing angle sign ambiguity.


gamma_Z_angle=2*pi+gamma_Z_angle;
end

if gamma_Z_angle>(2*pi)
gamma_Z_angle=gamma_Z_angle-2*pi;
end

% gamma_Z=pol2cart(gamma_Z_angle,gamma_Z_mod)
% gamma_Z=gamma_Z_mod*(cos(gamma_Z_angle)+1j*sin(gamma_Z_angle))
______________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com mailto:jgb2014@live.co.ukailto: attached: all 14 / 21
POZAR chapter 02 Transmission Line Basics: Example 03 16/04/2023 11:45:45.

hp1=plot(ax,real(gamma_Z),imag(gamma_Z),'ro')
hp1.LineStyle='none'
hp1.LineWidth=.5;
hp1.Marker='o';
hp1.MarkerSize=6;
hp1.MarkerFaceColor='none';
hp1.MarkerEdgeColor=c;

switch s

case 1 % print text showing Z=R+1jX values on Smith Chart

if imag(Z)<0
sign1='-';
else
sign1='+';
end
hold all;
plot(ax,real(gamma_Z),imag(gamma_Z),'ro','LineWidth',1.5);

str1=['ZL =' num2str(real(Z)) sign1 'j' num2str(abs(imag(Z))) '----' '\rightarrow'];

text(ax,real(gamma_Z),imag(gamma_Z)+.01,...
str1,'Color','blue',...
'FontSize',20,...
'HorizontalAlignment','right',...
'VerticalAlignment','middle');

case 0
% gamma already on SC . Put here more code in case
% some else to be done when NO explicit tag showing Z=R+1jX

otherwise
% s out of range
gamma_Z=0+1j*0;

disp('error: s can only be 1: print text, or 0: no text.')

end

% Support function for Smith_pinZ


function g1=z2gamma(z1,z0)
g1=(z1-z0)./(z1+z0);
end

end

______________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com mailto:jgb2014@live.co.ukailto: attached: all 15 / 21
POZAR chapter 02 Transmission Line Basics: Example 03 16/04/2023 11:45:45.

7.2.- Smith_swrCircle

Smith_swrCircle(ax,Z,Z0,c)

function [x_data,y_data]=Smith_swrCircle(ax,Z,Z0,c)
% PLOT_SWRCIRCLE plots SWR full circle, lossless TL
%
% INPUTS
% ax: graphics handles of figure containing Smith Chart generated with smithplot.
% Z: [ohm] impedance, NOT normalised
% Z0: [ohm] Transmission Line characteristic impedance
% c: color format [r g b] each ranging [0 1] where 0:white 1:black
%
% OUTPUT
% SWR full circle points in cartesian format

input_checks;

gamma=z2gamma(Z,Z0);
r=abs(gamma);
alpha=0:2*pi/100:2*pi;
hold all;
sub_hp2=plot(ax,r*cos(alpha),r*sin(alpha),'-','LineWidth',.5,'Color',c);

x_data=sub_hp2.XData;
y_data=sub_hp2.YData;

function input_checks
% support function for SMITH_SWRCIRCLE
[szc1 szc2]=size(c);
if szc1>1 || szc2~=3
disp('\ncolour wrong amount elements\n');
return;
end

if max(c>1) || min(c<0)
disp('\ncolour component(s) out of range\n');
return;
end

if numel(Z0)>1
disp('\nZ0 cannot be vector\n');
return;
end

Z=Z(:);
[sz1 sz2]=size(Z);
cas=1;
if sz2>1
cas=2;
end

end

end

______________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com mailto:jgb2014@live.co.ukailto: attached: all 16 / 21
POZAR chapter 02 Transmission Line Basics: Example 03 16/04/2023 11:45:45.

7.3.- Smith_swrArc

Smith_swrArc(ax,Z,Z0,a,RL,s)

function [x_data,y_data]=Smith_swrArc(ax,Z,Z0,a,RL,c)
% PLOT_SWRARC plots SWR arc a [rad] on Smith Chart CW or CCW according to RL and colour c
% TL assumed lossless
%
% INPUTS
% ax: graphics handles of figure containing Smith Chart generated with smithplot.
%
% Z: [ohm] impedance, NOT normalised, Start point of the Arc on Smith Chart
%
% Z0: [ohm] Transmission Line characteristic impedance
%
% a: [rad] arc angle
%
% RL : rotation direction [-1 1] -1: CW clockwise 1: CCW counter-clockwise
%
% c: color format [r g b] each ranging [0 1] where 0:white 1:black
%
% OUTPUT
% Arc points on Smith Chart in cartesian format starting on Z and CW/CWW according to RL

input_checks;

if 0<a<=pi/2 N=200; end % arc [rad] amount points


if pi/2<a<=pi N=300; end
if pi<a<=3*pi/2 N=400; end
if 3*pi/2<a<2*pi N=500; end

gamma_in=z2gamma(Z,Z0);

r=abs(gamma_in);

a0=angle(gamma_in); % start angle


if a0<0 a0=2*pi-abs(a0); end

az=(a0+RL*a); % stop angle


if az<0 az=2*pi-abs(az); end

gamma_out=r*(cos(az)+1j*sin(az));

q=0;
if az<a0 & RL==-1 q=1; end;
if az<a0 & RL==1 q=2; end;
if az>a0 & RL==-1 q=3; end;
if az>a0 & RL==1 q=4; end;

switch q
case 1 % az<a0 & CW
alpha=[a0:-a/N:az];

case 2 % az<a0 & CCW


alpha=[a0:a/N:2*pi 0:a/N:az];

case 3 % az>a0 % CW
alpha=[a0:-a/N:0 2*pi:-a/N:az];

case 4 % az>a0 % CCW

______________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com mailto:jgb2014@live.co.ukailto: attached: all 17 / 21
POZAR chapter 02 Transmission Line Basics: Example 03 16/04/2023 11:45:45.

alpha=[a0:a/N:az];

otherwise
disp('\nq within [1:4] only\n')
end

hold all;
sub_hp2=plot(ax,r*cos(alpha),r*sin(alpha),'-','LineWidth',2,'Color',c);

x_data=sub_hp2.XData;
y_data=sub_hp2.YData;

function input_checks
% support function for SMITH_SWRARC

if nargin~=6
disp('\ntrial version: 6 and only 6 input fields required\n');
return;
end

if numel(Z)>1
disp('\nZ scalar values only\n')
end

if numel(Z0)>1
disp('\nZ0 scalar only\n');
return;
end

a=abs(a); % don't care about a sign

if a==0 || mod(2*pi,a)==0
disp('\nChoose arc>0\n');
return;
end

if a>(2*pi) % if angle>360deg bring it within [0 360]


a=rem(2*pi,a);
end

% if a<0 % use positive angles only, all angles


% a=2*pi-abs(a);
% end

if ~(RL==[-1 1])
disp('\nRL has to be either -1:CW or 1:CCW\n');
end

[szc1 szc2]=size(c);
if szc1>1 || szc2~=3
disp('\ncolour [R G B] wrong amount elements\n');
return;
end

if max(c>1) || min(c<0)
disp('\ncolour component(s) out of range\n');
return;
end

end

end

______________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com mailto:jgb2014@live.co.ukailto: attached: all 18 / 21
POZAR chapter 02 Transmission Line Basics: Example 03 16/04/2023 11:45:45.

Comments and References

[1] QUCS : Quite Universal Circuit Simulator https://sourceforge.net/projects/qucs/

Home Page : http://qucs.sourceforge.net/


Documentation start page : http://qucs.sourceforge.net/docs.html
Components reference manual : http://qucs.github.io/qucs-manual/

If you need help on using QUCs, please join the help mailing list : qucs-help on SourceForge
(please attach the schematic you are having problems with)

IRC general discussion channel : #qucs on freenode.net

Additional resources : https://github.com/Qucs/qucs#resources

Some habits are not that easy to change: It would sell faster rebranding to just UCS : Universal Circuit Simulator.

[2] List of built-in circuit examples in QUCS

1. active_bp.sch 20. Comb_Gen.sch 40. lf_osci.sch 59. sawtooth-2.sch


2. active_lp.sch 21. diff1.sch 41. LPF_1000_Coplanar.sch 60. sawtooth-3.sch
3. active_mixer.sch 22. diode_hb.sch 42. LPF_1000_Radial- 61. sawtooth-discreet.sch
4. Amp_Baseband_Low- 23. elliptic_5th.sch Stub.sch 62. schmitt.sch
noise.sch 24. fet.sch 43. LPF_1250_Elliptical.sch 63. selective_amp.sch
5. Amp_Two_Tone.sch 25. fet_noise.sch 44. LPF-Balun2.sch 64. shot.sch
6. bbv.sch 26. fgummel.sch 45. LPF-Balun3.sch 65. single_balanced.sch
7. boostconverter.sch 27. fhr01fh.sch 46. microstrip.sch 66. singleOPV.sch
8. bpf_10Ghz.sch 28. filter_optimization.sch 47. mixer.sch 67. SmithChartTest.sch
9. BPF_1550_edge_cpld.sch 29. flicker.sch 48. mscoupler.sch 68. stab.sch
10. BPF_2000_Co-ax.sch 30. fullwaverectifier_1.sch 49. multiplier.sch 69. supply.sch
11. bridge.sch 31. fullwaverectifier_2.sch 50. notch.sch 70. swr_meter.sch
12. buckboost.sch 32. gain.sch 51. opamp_gyrator.sch 71. sym_osci.sch
13. buckconverter.sch 33. giacoletto.sch 52. pentode.sch 72. time_resistor.sch
14. charac.sch 34. gilbert.sch 53. preregulator.sch 73. triode.sch
15. chargepump.sch 35. groupdelay_ac.sch 54. Puls3b.sch 74. VCO_100.sch
16. chebyshev1_5th.sch 36. groupdelay_sp.sch 55. resonance.sch 75. wilkinson.sch
17. classic_osci.sch 37. gyrator.sch 56. rf_osci.sch 76. X2_100_Bipolar.sch
18. colpitts.sch 38. IdealBalun.sch 57. rgummel.sch 77. X5_500.sch
19. colpitts_base.sch 39. lc_osc.sch 58. sawtooth-1.sch

[3] QUCSTUDIO, a Free and Powerful Circuit Simulator

http://qucsstudio.de/
author :Michael Margraf

[4] QUCSTUDIO built-in Examples

DC analysis DC bias, nested sweeps

AC analysis noise contribution etc.

transient analysis oscillators, peak detectors, periodic steady-state analysis etc.

______________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com mailto:jgb2014@live.co.ukailto: attached: all 19 / 21
POZAR chapter 02 Transmission Line Basics: Example 03 16/04/2023 11:45:45.

s-parameter analysis gain/stability/noise circles, Touchstone files

HB analysis Harmonic Balance, large-signal AC, large-signal s-parameter analysis

digital simulations truth tables, Verilog, VHDL, etc.

system simulation optical telecommunication systems, eye diagrams, bit error rate (BER)

circuit optimization finding best-fit of component parameters

Monte-Carlo analysis estimation of tolerances

PCB layout designing a printed circuit board of an electrical circuit

Octave scripts, post-processing, mex files, script-based schematic creation

C++/VerilogA models creating user models

binary component library contains the following models: Curtice, Statz, TOM1…3, EKV, HICUM L0/L2, stripline and
more (many thanks to Mike Brinson for contributing most of the models)

SPICE import short description on how to import SPICE files

programming small examples for programming console applications in C/C++

EM simulation a few examples about electromagnetic field simulations

formulas Examples for formula sheets

______________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com mailto:jgb2014@live.co.ukailto: attached: all 20 / 21
POZAR chapter 02 Transmission Line Basics: Example 03 16/04/2023 11:45:45.

Where is the whole collection of exercises?


This exercise is part of the collection of exercises Microwave Engineering POZAR 4th ed solved with MATLAB
available in this website: https://jgb2012.wixsite.com/microwave-eng-matlab

How can one get the main literature reference?


For instance from: https://www.amazon.co.uk/Microwave-Engineering-David-M-Pozar/dp/0470631554

What about the solutions manual?


It's freely available https://www.scribd.com/doc/176505749/Microwave-engineering-pozar-4th-Ed-solutions-manual

For educational purposes only: https://www.copyrightuser.org/understand/exceptions/education/

______________________________________________________________________________________________________________________________
John Bofarull Guix jgb2012@sky.com mailto:jgb2014@live.co.ukailto: attached: all 21 / 21

You might also like