# Designing Matching Networks Using Single Stub Transmission Lines

This example shows how to design an input and output matching networks for an amplifier. The input and output matching networks for this amplifier element is designed using singe stub transmission lines and this matching networks aims to maximize power delivered to a 50-ohm load and system. To do so, this example:

• Calculates the reflection factors for simultaneous conjugate match.

• Determines the placement of a shunt stub in each matching network at a specified frequency.

• Cascades the matching networks with the amplifier and plots the results.

### Create Amplifier Element

Create an amplifier object to represent the amplifier described by the measured frequency-dependent S-parameter data in the file samplebjt2.s2p. Then, extract the frequency-dependent S-parameter data from the rfckt.amplifier object.

amp = amplifier(UseNetworkData=true, FileName='samplebjt2.s2p'); S = amp.NetworkData; Freq = S.Frequencies;

### Check for Amplifier Stability

Before proceeding with the design, determine the measured frequencies at which the amplifier is unconditionally stable. Use the stabilitymu function to calculate mu and muprime at each frequency. Then, check that the returned values for mu are greater than one. This criteria is a necessary and sufficient condition for unconditional stability. If the amplifier is not unconditionally stable, print out the corresponding frequency value.

[mu,muprime] = stabilitymu(S); figure plot(Freq/1e9,mu,'--',Freq/1e9,muprime,'r') legend('MU',"MU'",'Location','Best') title("Stability Parameters MU and MU'") xlabel('Frequency [GHz]')

disp('Measured Frequencies where the amplifier is not unconditionally stable:')
Measured Frequencies where the amplifier is not unconditionally stable: 
fprintf('\tFrequency = %.1e\n',Freq(mu<=1))
 Frequency = 1.0e+09 Frequency = 1.1e+09 

For this example, the amplifier is unconditionally stable at all measured frequencies except 1.0 GHz and 1.1 GHz.

### Determine Source and Load Matching Networks for Simultaneous Conjugate Match

Begin designing the input and output matching networks by transforming the reflection coefficients for simultaneous conjugate match at the amplifier interfaces into the appropriate source and load admittance. This example uses the following lossless transmission line matching scheme:

The design parameters for this single stub matching scheme are the location of the stubs with reference to the amplifier interfaces and the stub lengths. The procedure uses the following design principles:

• The center of the Smith chart represents a normalized source or load immittance.

• Movement along a transmission line is equivalent to traversing a circle centered at the origin of the Smith chart with radius equal to a reflection coefficient magnitude.

• A single transmission line stub can be inserted at the point on a transmission line when its admittance (transmission line) intersects the unity conductance circle. At this location, the stub will negate the transmission line susceptance, resulting in a conductance that equals the load or source terminations.

This example uses the YZ Smith chart because it's easier to add a stub in parallel with a transmission line using this type of Smith chart.

### Calculate and Plot the Complex Load and Source Reflection Coefficients

Calculate and plot all complex load and source reflection coefficients for simultaneous conjugate match at all measured frequency data points that are unconditionally stable. These reflection coefficients are measured at the amplifier interfaces.

AllGammaL = gammaml(S); AllGammaS = gammams(S); hsm = smithplot(figure, [AllGammaL AllGammaS]); hsm.LegendLabels = {'#Gamma ML','#Gamma MS'};

### Determine Load Reflection Coefficient at Single Frequency

Find the load reflection coefficient, GammaL, for the output matching network at the design frequency 1.9 GHz.

freq = Freq(Freq == 1.9e9); GammaL = AllGammaL(Freq == 1.9e9)
GammaL = -0.0421 + 0.2931i 

### Draw Constant Magnitude Circle for Load Reflection Coefficient GammaL

Draw a circle that is centered at the normalized admittance Smith chart origin and whose radius equals the magnitude of GammaL. A point on this circle represents the reflection coefficient at a particular location on the transmission line. The reflection coefficient for the transmission line at the amplifier interface is GammaL, while the center of the chart represents the normalized load admittance, y_L.

hsm = smithplot(figure); hold on d = (1:360); x = abs(GammaL)*cosd(d); y = abs(GammaL)*sind(d); plot(x,y) hsm.GridType = 'yz'; plot(0,0,'k.','MarkerSize',16) plot(GammaL,'k.','MarkerSize',16) txtstr = sprintf('\\Gamma_{L}\\fontsize{8}\\bf=\\mid%s\\mid%s^\\circ', ... num2str(abs(GammaL),4),num2str((angle(GammaL)*180/pi),4)); text(real(GammaL),imag(GammaL)+.1,txtstr,'FontSize',10, ... 'FontUnits','normalized'); plot(0,0,'r',0,0,'k.','LineWidth',2,'MarkerSize',16); text(0.05,0,'y_L','FontSize',12,'FontUnits','normalized')

### Draw Unity Constant Conductance Circle and Find Intersection Points

To determine the stub wavelength (susceptance) and its location with respect to the amplifier load matching interface, plot the normalized unity conductance circle and the constant magnitude circle and figure out where the two circles intersect. Find the points of intersection interactively using the data cursor or analytically using the helper function, imped_match_find_circle_intersections_helper. This example uses the helper function. The circles intersect at two points. The example uses the third-quadrant point, which is labeled "A". The unity conductance circle is centered at (-.5,0) with radius .5. The constant magnitude circle is centered at (0,0) with radius equal to the magnitude of GammaL.

d = (1:360); x = 0.5*cosd(d)-0.5; y = 0.5*sind(d); plot(x,y,'r'); % hsm.ColorOrder(2,:) = [1 0 0]; % figure [~,pt2] = imped_match_find_circle_intersections_helper([0 0], ... abs(GammaL),[-.5 0],.5); GammaMagA = sqrt(pt2(1)^2 + pt2(2)^2); GammaAngA = atan2(pt2(2),pt2(1)); % ax = hsm.Parent.CurrentAxes; % hold (ax,"on"); plot(pt2(1),pt2(2),'k.','MarkerSize',16); txtstr = sprintf('A=\\mid%s\\mid%s^\\circ',num2str(GammaMagA,4), ... num2str(GammaAngA*180/pi,4)); text(pt2(1),pt2(2)-.07,txtstr,'FontSize',8,'FontUnits','normalized', ... 'FontWeight','Bold') container = hsm.Parent; annotation('textbox','VerticalAlignment','middle',... 'String',{'Unity','Conductance','Circle'},... 'HorizontalAlignment','center','FontSize',8,... 'EdgeColor',[0.04314 0.5176 0.7804],... 'BackgroundColor',[1 1 1],'Position',[0.1403 0.1608 0.1472 0.1396]) annotation('arrow',[0.2786 0.3286],[0.2778 0.3310]) annotation('textbox','VerticalAlignment','middle',... 'String',{'Constant','Magnitude','Circle'},... 'HorizontalAlignment','center','FontSize',8,... 'EdgeColor',[0.04314 0.5176 0.7804],... 'BackgroundColor',[1 1 1],'Position',[0.8107 0.3355 0.1286 0.1454]) annotation('arrow',[0.8179 0.5761],[0.4301 0.4887]);

### Calculate Stub Location and Stub Length for Output Matching Network

The open-circuit stub location in wavelengths from the amplifier load interface is a function of the clockwise angular difference between point "A" and GammaL. When point "A" appears in the third quadrant and GammaL falls in the second quadrant, the stub position in wavelengths is calculated as follows:

StubPositionOut = ((2*pi + GammaAngA) - angle(GammaL))/(4*pi)
StubPositionOut = 0.2147 

The stub value is the amount of susceptance that is required to move the normalized load admittance (the center of the Smith chart) to point "A" on the constant magnitude circle. An open stub transmission line can be used to supply this value of susceptance. Its wavelength is defined by the amount of angular rotation from the open-circuit admittance point on the Smith chart (point "M" on the following figure) to the required susceptance point "N" on the outer edge of the chart. Point "N" is where a constant susceptance circle with a value equal to the susceptance of point "A" intersects the unit circle. In addition, the StubLengthOut formula used below requires "N" to fall in the third or fourth quadrant.

Calculate the stub length of the output matching metwork.

GammaA = GammaMagA*exp(1j*GammaAngA); bA = imag((1 - GammaA)/(1 + GammaA)); StubLengthOut = -atan2(-2*bA/(1 + bA^2),(1 - bA^2)/(1 + bA^2))/(4*pi)
StubLengthOut = 0.0883 

### Calculate Stub Location and Stub Length for Input Matching Network

In the previous sections, the example calculated the required lengths and placements, in wavelengths, for the output matching transmission network. Following the same approach, the line lengths for the input matching network are calculated:

GammaS = AllGammaS(Freq == 1.9e9)
GammaS = -0.0099 + 0.2501i 

Calculate the stub location of the input matching network.

[pt1,pt2] = imped_match_find_circle_intersections_helper([0 0], ... abs(GammaS),[-.5 0],.5); GammaMagA = sqrt(pt2(1)^2 + pt2(2)^2); GammaAngA = atan2(pt2(2),pt2(1)); GammaA = GammaMagA*exp(1j*GammaAngA); bA = imag((1 - GammaA)/(1 + GammaA)); StubPositionIn = ((2*pi + GammaAngA) - angle(GammaS))/(4*pi)
StubPositionIn = 0.2267 

Calculate the stub length of the input matching metwork.

StubLengthIn = -atan2(-2*bA/(1 + bA^2),(1 - bA^2)/(1 + bA^2))/(4*pi)
StubLengthIn = 0.0759 

### Verify Design

To verify the design, assemble a circuit using 50-Ohm microstrip transmission lines for the matching networks. First, determine if the microstrip line is a suitable choice by analyzing the default microstrip transmission line at a design frequency of 1.9 GHz.

stubTL4 = txlineMicrostrip; [Z0, Eeff_f] = getZ0(stubTL4);

This characteristic impedance is close to the desired 50-Ohm impedance, so the example can proceed with the design using these microstrip lines.

To calculate the required transmission line lengths in meters for the placement of the stubs, analyze the microstrip to obtain a phase velocity value.

phase_vel = rf.physconst("LightSpeed")./sqrt(Eeff_f);

Use the phase velocity value, which determines the transmission line wavelength and the stub location to set the appropriate transmission line lengths for the two microstrip transmission lines, TL2 and TL3.

TL2 = txlineMicrostrip('LineLength',phase_vel/freq*StubPositionIn); TL3 = txlineMicrostrip('LineLength',phase_vel/freq*StubPositionOut);

Use the phase velocity again to specify stub length and stub mode for each stub.

stubTL1 = txlineMicrostrip('LineLength',phase_vel/freq*StubLengthIn, ... 'StubMode','shunt','Termination','open'); set(stubTL4,'LineLength',phase_vel/freq*StubLengthOut, ... 'StubMode','shunt','Termination','open')

Now cascade the circuit elements and analyze the amplifier with and without the matching networks over the frequency range of 1.5 to 2.3 GHz.

matched_amp = circuit([stubTL1 TL2 amp TL3 stubTL4]); Samp = sparameters(matched_amp, (1.5e9:1e7:2.3e9));

To verify the simultaneous conjugate match at the input of the amplifier, plot the S11 parameters in dB for both the matched and unmatched circuits.

clf rfplot(S,1,1,'dB') hold on rfplot(Samp,1,1,'dB') legend('S_{11} - Original Amplifier', 'S_{11} - Matched Amplifier') legend('Location','SouthEast') xlim([1.5 2.3]) hold off

To verify the simultaneous conjugate match at the output of the amplifier, plot the S22 parameters in dB for both the matched and unmatched circuits.

rfplot(S,2,2,'dB') hold on rfplot(Samp,2,2,'dB') legend('S_{22} - Original Amplifier', 'S_{22} - Matched Amplifier') legend('Location','SouthEast') xlim([1.5 2.3]) hold off

Finally, plot the transducer gain (Gt) and the maximum available gain (Gmag) in dB for the matched circuit.

Gt = 10*log10(powergain(Samp,'Gt')); Gmag = 10*log10(powergain(Samp,'Gmag')); figure; plot(Samp.Frequencies/1e9, [Gt Gmag]) legend({'Gt','Gmag'}) xlabel('Frequency (GHz)') ylabel('Gain (dB)')

You can see that the transducer gain and the maximum available gain are very close to each other at 1.9 GHz.