Viewing blog entries in category: MATLAB

Question:
Literature source [POZAR] available here:
https://www.amazon.co.uk/MicrowaveEngineeringDavidMPozar/dp/0470631554
There's also a solutions manual available here:
https://www.scribd.com/doc/176505749/Microwaveengineeringpozar4thEdsolutionsmanual
Answer:
MATLAB script source pozar_05_example_01.m and all necessary support functions included in .zip here attached file pozar_05_example_01.zip
including detailed explanation. Following, the key points:
For the given load, the component values are
C1 = 9.227738300997709e13
ctype =C [Farad]
L1 = 3.898484006168380e08
ltype =L [Henry]
L2 = 2.167378326912196e+07
ctype =L [Henry]
C2 = 3.847649490485592e+11
ltype =C [Farad]
with frequency response
With ADS, using the component DA_SmithCharftMatch that opens the Smith Chart Utility
that readily obtains the component values
the term 'series' is here used as the jX component connected in both circuits as above.
But in some literature sources like [MEDLY] a distinction is made between 'cascade' that would the jX component connection above, and 'series' would be this:
[MEDLY] Microwave and RF Circuits: Analysis, Synthesis and Design. Author Max W Medley Jr.
John BG 
Question:
Literature source [POZAR] available here:
https://www.amazon.co.uk/MicrowaveEngineeringDavidMPozar/dp/0470631554
There's also a solutions manual available here:
https://www.scribd.com/doc/176505749/Microwaveengineeringpozar4thEdsolutionsmanual
Answer:
MATLAB script source pozar_05_exercise_25.m and all necessary support functions included in .zip here attached file pozar_05_exercise_25.zip
including detailed explanation. Following, the key points:
for a load located here
the following 2element Lshape match circuits are possible:
the values of the components are
C1 = 1.258213410121157e12
L1 = 5.012370792994983e09
L2 = 2.169965544798663e08
C2 = 1.263388970843133e12
the resulting fractional bandwidths are
df_ov_BW1 = 0.188090595470227
df_ov_BW2 = 0.194140292985351
there are 2 related errors in the solutions manual:
1.
this dw is f2f1 so the calculation goes right to left, dw is a known parameter that along with the other values is used to verify
true(dw1*log(1/gamma_m)=<pi*R/L)
=
logical
1
true(dw2*log(1/gamma_m)=<pi*R/L)
=
logical
1
f2 and f1 are also obtained, dw1 dw2 being
dw1=2*pi*(f2_sol1f1_sol1)
dw1 = 2.363105994030242e+09
dw2=2*pi*(f2_sol2f1_sol2)
dw2 = 2.439132536247116e+09
2.
again, this 174% is not the fractional bandwidth of the only circuit suggested in the solutions manual, the fractional bandwidths for solutions are shown above.
John BG
jgb2012@sky.com 
Question:
Literature source [POZAR] available here:
https://www.amazon.co.uk/MicrowaveEngineeringDavidMPozar/dp/0470631554
There's also a solutions manual available here:
https://www.scribd.com/doc/176505749/Microwaveengineeringpozar4thEdsolutionsmanual
Answer:
MATLAB script source pozar_05_exercise_13.m and all necessary support functions included in .zip here attached file pozar_05_exercise_13.zip
MATLAB, an ADS circuit, the ADS LinCalc Utility and the online free microstrip calculator, these tools are used to dimension microstrip tracks as required in the question. The higher ZL/Z0 the sharper, more selective, becomes the frequency response.
John BG
jgb2012@sky.com 
Question:
Literature source [POZAR] available here:
https://www.amazon.co.uk/MicrowaveEngineeringDavidMPozar/dp/0470631554
There's also a solutions manual available here:
https://www.scribd.com/doc/176505749/Microwaveengineeringpozar4thEdsolutionsmanual
Answer:
As explained in the attached answer the error peaks at multiples of λ/2.
John BG
jgb2012@sky.com 
Question:
Literature source [POZAR] available here:
https://www.amazon.co.uk/MicrowaveEngineeringDavidMPozar/dp/0470631554
There's also a solutions manual available here:
https://www.scribd.com/doc/176505749/Microwaveengineeringpozar4thEdsolutionsmanual
Answer:
Basic MATLAB script source pozar_05_exercise_15.m
I call this one 'basic' because for this exercise the MATLAB script doesn't go much further than getting the cutoff details.
As the reader can appreciate for this exercise I have used ADS instead to supply the result of the matching waveguide section because
it's in chapter 3 of [POZAR] where it makes more sense to review 3D electromagnetic models but I chose to start in chapter 5, so this exercise
can be reviewed once for instance a working Yee model in MATLAB is available, that allows enough flexibility and accuracy
needed to change waveguide dimensions and fillup dielectric characteristics in order to reach a valid affordable solution like it's the case here to be a dielectric fin instead of a complete fillup.
John BG
jgb2012@sky.com 
Question:
Literature source [POZAR] available here:
https://www.amazon.co.uk/MicrowaveEngineeringDavidMPozar/dp/0470631554
There's also a solutions manual available here:
https://www.scribd.com/doc/176505749/Microwaveengineeringpozar4thEdsolutionsmanual
Answer:
MATLAB script source pozar_05_exercise_16.m and all necessary support functions included in .zip here attached file pozar_05_exercise_16.zip
The more sections added the flatter is the passband but the size of the circuit increases. Despite Binomial has as flat frequency response around f0 it doesn't have the best insertion loss, not .6 at 2*f0.
John BG
jgb2012@sky.com 
Question:
Literature source [POZAR] available here:
https://www.amazon.co.uk/MicrowaveEngineeringDavidMPozar/dp/0470631554
There's also a solutions manual available here:
https://www.scribd.com/doc/176505749/Microwaveengineeringpozar4thEdsolutionsmanual
Answer :
MATLAB script source pozar_05_exercise_17.m and all necessary support functions included in .zip here attached file pozar_05_exercise_17.zip
This question is again the kind that one thinks the Symbolic Toolbox is going to be the perfect tool but again
the Symbolic Toolbox returns 9 DIN4 pages full of a Symbolic expression that cannot be called a solution. let alone
handled without a crane.
Luckily it can be solved numerically, as shown in the attached script and notes.
Firstly it's convenient to find out Z1 and Z2 to validate the sought expressions
 Z1(ZL,Z0)
 Z2(ZL,Z0)
z1 z2 turn out to be 1.1067 and 1.3554
the frequency response of Γ is
As shown in the attached script, the ABCD expressions can be manipulated to obtain the following
that in turn reveals (Z2/Z1) Z2_ov_Z1 = 1.224563802132642
From here all that's left is to calculate the characteristic impedance of the λ/4 section next to load Z2, from [POZAR] 253pg.
gamma_n(2)==(ZL_ov_Z0z2)/(ZL_ov_Z0+z2)
John BG
jgb2012@sky.com 
Question
Literature source [POZAR] available here:
https://www.amazon.co.uk/MicrowaveEngineeringDavidMPozar/dp/0470631554
There's also a solutions manual available here:
https://www.scribd.com/doc/176505749/Microwaveengineeringpozar4thEdsolutionsmanual
Answer
This one is easy
ZL_ov_Z0=[1.5:.01:6];
for n=N
A=2^(n)*(ZL_ov_Z01)./(ZL_ov_Z0+1);
df_over_f0=24./pi*acos(.5*(gamma_m./abs(A)).^(1/n));
plot(ZL_ov_Z0,df_over_f0);hold all
end
title('\Deltaf/f0');xlabel('ZL/Z0');grid on
John BG
jgb2012@sky.com 
Question:
Answer:
Literature source [POZAR] available here:
https://www.amazon.co.uk/MicrowaveEngineeringDavidMPozar/dp/0470631554
There's also a solutions manual available here:
https://www.scribd.com/doc/176505749/Microwaveengineeringpozar4thEdsolutionsmanual
The question only asks for the short circuit cases, but all open circuit results have been added.
John BG
jgb2012@sky.com 
Question:
Answer:
Literature source [POZAR] available here:
https://www.amazon.co.uk/MicrowaveEngineeringDavidMPozar/dp/0470631554
There's also a solutions manual available here:
https://www.scribd.com/doc/176505749/Microwaveengineeringpozar4thEdsolutionsmanual
the solutions manual erroneously solves for single stub, ignoring X2, the reactance of the 2nd stub.
The sought solutions have to be of the following shape
· D_OCstub1(d,RL,XL)
· D_OCstub2(d,RL,XL)
· D_SCstub1(d,RL,XL)
· D_SCstub2(d,RL,XL)
the RL constraint would imply that there would be need for a really long transmission line for really small RL values, or that there would be need for really short transmission line when attempting to match large RL values.
Numerical and symbolic equations are supplied. For the numerical case 2D slice
is not as meaningful as visualizing the volume with both a static and a shifting plane
John BG
jgb2012@sky.com 
Question
Literature source [POZAR] available here:
https://www.amazon.co.uk/MicrowaveEngineeringDavidMPozar/dp/0470631554
There's also a solutions manual available here:
https://www.scribd.com/doc/176505749/Microwaveengineeringpozar4thEdsolutionsmanual
Answer
5.9 is already solved here:
https://forum.allaboutcircuits.com/...ozarchapter05exercise09withmatlab.1477/
MATLAB script source pozar_05_exercise_09.m and all necessary support functions included in .zip here attached file pozar_05_exercise_09.zip
Reducing s11 the resolution can be improved from 0.001 to 0.0002 without significant increase in processing delay.
For this exercise, the peaks do not show as clearly as in 5.9 so the funciton kmeans comes handy to decide where the s11 nulls are exactly located.
Verifying the frequency responside directly connecting impedance equations for each component
Like in 5.9 some additional ADS simluations and optimiser results are included, but ADS has more accurate models of all circuit components, even for such basic ones, so the results obtained with an accurate but basic MATLAB script, and using ADS, are not going to always agree.
John Bofarull Guix
jgb2012@sky.com 
Question
Literature source [POZAR] available here:
https://www.amazon.co.uk/MicrowaveEngineeringDavidMPozar/dp/0470631554
There's also a solutions manual available here:
https://www.scribd.com/doc/176505749/Microwaveengineeringpozar4thEdsolutionsmanual
Answer
MATLAB script source pozar_05_exercise_09.m and all necessary support functions included in .zip here attached file pozar_05_exercise_09.zip
In the attached zip there is a detailed explanation in Adobe format detailing all lines of the solution.
An analytic solution with s11 surface is show and the frequency response to valide the calculated lengths is obtained with different crosssections of such surface.
The sought Open Ciruit shunt stub lengths are the shortest D1 D2 that null s11
The obtention of the s11 surface nulls, the exact location where D1 D2 cancel reflections is found reversing the surface and catching peaks.
This is because when attemting too small D1 D2 steps, with conventional computer platforms MATLAB may reach default limits or borrow excessive
time.
The Laplacian obtained with del2 is here conveniently used to reduce the amount of peaks returned by command findpeaks.
1st solution, stubs with lengths below 0.5:
D11=0.086
D12=0.375
2nd solution
D21=0.199
D22=0.375
Some of the support functions used in previous questions have been ugraded to solve this exercise with the Smith chart.
1st stub, next to load, 1st length. The red is ZL and the green marker is YL=1/ZL.
the 1st stub has to bring YL to the magenta circle, to the intersection blue marker to the left hand side of YL.
1st stub, 2nd length, reaching the 2nd intersection now with opposite sign reactance.
2nd stub, 1st length, 3rd and 4th intersections again are the blue markers.
2nd stub, 2nd length
The resulting stub lengths match those obtained analytically.
Verifying results with frequency response:
It turns out that for a given pair D1 D2 the frequency resonse is already a particular cross section of surface s11.
Choosing 2 cross sections including those pairs D1 D2 reaching s11 nulls,
And the extracted contours are
and
Any comments welcome
John Bofarull Guix
jgb2012@sky.com 
Question:
Literature source [POZAR] available here:
https://www.amazon.co.uk/MicrowaveEngineeringDavidMPozar/dp/0470631554
There's also a solutions manual available here:
https://www.scribd.com/doc/176505749/Microwaveengineeringpozar4thEdsolutionsmanual
Answer:
Certain loads can be matched at a single frequency with just a transmission line with the correct characteristic impedance and length.
Attached MATLAB script to to calculate Z1 and L of such transmission load to match to Z0, not all loads can be matched with such simple circuit.
John BG
jgb2012@sky.com 
Question
Literature source [POZAR] available here:
https://www.amazon.co.uk/MicrowaveEngineeringDavidMPozar/dp/0470631554
There's also a solutions manual available here:
https://www.scribd.com/doc/176505749/Microwaveengineeringpozar4thEdsolutionsmanual
Answer
For Open Circuit and Short circuit lossy transmission line stubs there are peaks of valleys of reactance close to multiples of λ/4 and 3λ/4 (equivalent electric lengths π/2 and 3π/2).
Since there's always some real part of the input impedance, it's about choosing a length that supplies high enough reactance while keeping the resistive part low enough for the OC/SC stub to be considered an equivalent 'good' capacitor or inductor.
Attached MATLAB script that shows how to find such reactance peaks and valleys for a section of lossy transmission line. 
Question
Answer
the literature source [POZAR] is available here:
https://www.amazon.co.uk/MicrowaveEngineeringDavidMPozar/dp/0470631554
There's also a solutions manual available here:
https://www.scribd.com/doc/176505749/Microwaveengineeringpozar4thEdsolutionsmanual
this is the OC series stub impedance match circuit on single frequency.
The arcs of the transmission line lengths on the Smith chart are:
And the OC series stub arcs:
There's also an alternative graph to find the required transmission line and stub lengths; s11 surface.
clc;clear all;close all
ZL=90+1j*60;Z0=75;
Dstep=.001;drange=[0: Dstep:1];
D1=drange;D2=D1;
[D1,D2]=meshgrid(drange);
Z1=Z0*(ZL+1j*Z0*tan(2*pi*D1))./(Z0+1j*ZL*tan(2*pi*D1));
Zin_stub=Z0./(1j*tan(2*pi*D2)); % series oc stub
Zin=Z1+Zin_stub;
s11=(ZinZ0)./(Zin+Z0);
surf(abs(s11),'LineStyle','none')
ax=gca
xlabel('D1');ylabel('D2');
ax.XTickLabelMode='manual'; ax.YTickLabelMode='manual';
ax.XTickLabel=[0:0.1:1];ax.YTickLabel=[0:0.1:1];
ax.XTick=[0:100:1000];ax.YTick=[0:100:1000];
ax.PlotBoxAspectRatio=[1 1 1]
hold all;x0=find(drange==.5) % plotting corner to box D1<.5 D2<.5
plot3([x0 x0 0],[0 x0 x0],[5 5 5],'Color',[1 0 0],'LineWidth',3)
% moving camera birdeye view
ax.CameraPosition=[500 500 10]
camzoom(ax,1.5) % zoom in a bit, camzoom is cumulative
% zoom_factor within [0 1) zooms out zoom_factor>1 zooms in
ax.CameraUpVector = [0 1 0]; % camera attitude
ax.CameraTarget = [500 500 0]; % centring
ax.CameraViewAngle =8*pi; % focus
automating peaks capture: findpeaks with MinPeakProminence=2.5 returns the right amount of peaks. MinPeakProminence larger or smaller than 2.5 then either too few or too many peaks.
With MinPeakHeight=2 command findpeaks doesn't catch the right amount of peaks for any MinPeakDistance, going from 6 peaks only to too many peaks.
With Threshold=2 doesn't catch a single peak but Threshold=1 gets the right amount of peaks.
To get zeros exact locations, it's useful to invert s11 surface just plotted, with the Laplacian of the surface, command del2
V=1e3*del2(abs(s11));
figure(2);ax=gca;surf(V,'Lines','none');
xlabel('D1');ylabel('D2');
ax.XTickLabelMode='manual';
ax.YTickLabelMode='manual'; ax.XTickLabel=[0:0.1:1];ax.YTickLabel=[0:0.1:1];
ax.XTick=[0:100:1000];ax.YTick=[0:100:1000];
[pks,locs]=findpeaks(V( : ),'Threshold',1);
[nd1,nd2]=ind2sub(size(V),locs);
hold all;figure(2);plot3(nd2,nd1,V(nd2,nd1)+2,'ro'); % plot peaks
ax.PlotBoxAspectRatio=[1 1 1]
x0=find(drange==.5) % plot corner to box D1<.5 D2<.5
figure(2);
plot3([x0 x0 0],[0 x0 x0],[.5 .5 .5],'Color',[1 0 0],'LineWidth',3)
ax2=gca
ax2.CameraPosition=[500 500 10] % moving camera birdeye view
ax2.CameraUpVector = [0 1 0]; % camera attitude
camzoom(ax,1.5) % zoom in a bit, camzoom is cumulative
% zoom_factor within [0 1) zooms out zoom_factor>1 zooms in
ax2.CameraTarget = [500 500 0]; % centring
abs(s11(sub2ind(size(V),nd1,nd2)))
= 0.001390798787950
0.001390798787950
0.002883920448033
0.002883920448033
0.001390798787950
0.001390798787950
0.002883920448033
0.002883920448033
unique(sort(drange(nd1)))
= 0.1470 0.3530 0.6470 0.8530
numel(nd1)
= 8
among these stub lengths
D1=unique(drange(nd1))
= 0.1470 0.3530 0.6470 0.8530
D2=unique(drange(nd2))
= 0.1740 0.4820 0.6740 0.9820
the stub lengths inside D<.5 are the smallest ones
Dstub1= D1([1 2])
= 0.1470 0.3530
Dstub2= D2([1 2])
= 0.1740 0.4820
The resulting frequency response is the same as the one obtained with the MATLAB solution
So the problem is simple enough to find transmission line and stub length on a surface.
Quick check how short circuit and open circuit stubs behave over frequency:
Zin_sc_stub=1j*Z0*tan(beta*L)
Zin_oc_stub=1j*Z0*cot(beta*L)
da=pi/2000;a=[2*pi:da:2*pi];
y_OC=cot(a); y_SC=tan(a);
figure;plot(a,y_OC,a,y_SC);
grid on;axis([2*pi 2*pi 10 10])
legend('SC','OC')
ylabel('Stub Z_i_n');xlabel('\betaL')
xticks([2*pi 2*pi*3/4 pi pi/2 0 pi/2 pi 3*pi/2 2*pi])
xticklabels({'2\pi','3\pi/4','\pi','\pi/2','0','\pi/2','\pi','3\pi/2','2\pi'})
John BG
jgb2012@sky.com
Page 1 of 2