## Exploring Maximum Power Transfer with 3D Plots in Matlab

I recently took a course in circuit analysis where we learned the maximum power transfer theorem.  While there are many plots of the power transfer in the purely resistive case, I did not see any for the case where the source and loads are impedances (with both resistance and reactance).  I played around with 3D plots to get a better understanding of power transfer and to practice using Matlab.  Here is a write-up of what I did.

# Introduction

We will analyze the following circuit: Image: “Source and load circuit Z“. Licensed under CC BY-SA 3.0 via Wikimedia Commons.

The relevant elements are as follows:

• $V_S$ is the voltage source, which we assume to be a steady-state sinusoidal source.
• $Z_S=R_S+X_Sj$ is the source or internal impedance (with resistance $R_S$ and reactance $X_S$).
• $Z_L=R_L+X_Lj$ is the load impedance (with resistance $R_L$ and reactance $X_L$).

The idea is to find the amount of power transferred to the load by the voltage source given a fixed source impedance.  We are particularly interested in finding the load impedance that will give us the maximum power transfer to the load.  There are many references that discuss these concepts, so I will not go into more detail here.  I will note however that there is an interesting article “Non-Calculus Derivation of the Maximum Power Transfer Theorem” by Dr. Kenneth V. Cartwright which discusses the theory in a non-traditional manner.

I will show the equations, but will not derive them – I will use the same notation and form as found in the “Maximum power transfer theorem” Wikipedia article.  I will include short Matlab code blocks throughout this document.  These are meant to be run in order (in other words, each code snippet will depend on variables or plots from previous snippets).  I am no Matlab expert, so I am sure there are better ways to write and present the code. For variables, I use the following convention: scalar constants are designated with lower case letters, whereas vectors and matrices are designated with upper case letters. For simplicity, I use the value 1 for all constants.  To get the most detail from the plots I include, you will need to click on the images.

# Power Transfer with Pure Resistance

For the purely resistive case ( $X_L=X_S=0$), the average load power as a function of load resistance (we assume the source voltage and load resistance are constants) is: $P_L(R_L)=\frac{1}{2}\frac{|V_S|^2R_L}{(R_S+R_L)^2}$

The plot of this power function is found in many places. We can plot it ourselves as follows:

vs = 1;        % Source voltage is normalized to 1V
rs = 1;        % Source resistance is normalized to 1 ohm

RL = 0:0.1:7;  % Use load resistance in the range (0,5) ohms

% Calculate power
P = 0.5 * (vs.^2 .* RL) ./ ((rs + RL).^2);

% Plot the power
figure;
plot(RL,P);
title('Power Transfer (Resistive Case)');
ylabel('Average Power Transfer'); As can be confirmed by the graph, maximum power transfer occurs at $R_L=R_S=1$ where $P=\frac{1}{8}W$

# Power Transfer with Impedance

The load power as a function of load impedance (as before we assume the source voltage and load impedance are constants) is: $P_L(R_L,X_L)=\frac{1}{2}\frac{|V_S|^2R_L}{(R_S+R_L)^2+(X_S+X_L)^2}$

We can plot this function as follows:

xs = 1;        % Source impedance is normalized to 1 ohm

XL = -5:0.1:5; % Use load reactance in the range (-5,5) ohms

% Build a mesh grid for the 3D plot
[RL_mesh,XL_mesh] = meshgrid(RL, XL);

% Calculate power
P = 0.5 * (vs.^2 .* RL_mesh) ./ ((rs + RL_mesh).^2 + (xs + XL_mesh).^2 );

% Plot the power
figure;
surf(RL_mesh, XL_mesh, P);
title('Power Transfer (Reactive Case)');
xlabel('RL (ohms)');
ylabel('XL (ohms)'); # Lines of Maximum Power Transfer

For a given $R_L$ we can find the $X_L$ that gives the maximum power by solving the equation $\frac{\partial P_L}{\partial X_L}=0$ to get: $X_L=-X_S$

Note that the impedance turns out to be independent of $R_L$.  We can plot a line to follow this maximum power:

% Calculate reactance where power is maximum for each resistance (note it is constant)
XLMAX = -xs * ones(size(RL));

% Calculate maximum power along the line
PMAX = 0.5 .* (vs.^2 .* RL) ./ ((rs + RL).^2 + (xs + XLMAX).^2 );

% Plot the line on top of the existing surface
hold on;
plot3(RL, XLMAX, PMAX,'LineWidth',2,'Color',[0 0 0]);


Likewise, for a given $X_L$ we can find the $R_L$ that gives the maximum power by solving the equation $\frac{\partial P_L}{\partial R_L}=0$ to get: $R_L(X_L)=\sqrt{R_S^2+(X_S+X_L)^2}$

We can plot a line to follow this maximum power as well:

% Calculate resistance where power is maximum for each reactance
RLMAX = sqrt(rs^2 + (XL + xs).^2);

% Calculate maximum power along the line
PMAX= 0.5 .* (rs.^2 .* RLMAX) ./ ((rs + RLMAX).^2 + (xs + XL).^2 );

% Plot the line on top of the existing surface
hold on;
plot3(RLMAX, XL, PMAX,'LineWidth',2,'Color',[0 0 0]); Maximum power occurs where the lines intersect. As can be confirmed on the graph, this occurs when the source and load impedances are complex conjugates of eachother: $Z_L=Z_S^*=R_S-X_Sj=1-j$

As before the maximum power is $P=\frac{1}{8}W$.

# Efficiency

The efficiency (power dissipated in the load versus total power dissipated) is a function of resistance only: $\eta(R_L)=\frac{R_L}{R_S+R_L}$

In the plots so far, the surface is colored automatically to match the magnitude of the power (blue indicates a smaller magnitude and red indicates a larger magnitude). We can also specify our own color scheme. For example we could color the surface to indicate the degree of efficiency:

% Calculate efficiency
EFF = RL_mesh ./ (rs + RL_mesh);

% Plot a new graph which indicates efficiency using color
figure;
surf(RL_mesh , XL_mesh, P, EFF);
title('Power Transfer (with Efficiency)');
xlabel('RL (ohms)');
ylabel('XL (ohms)'); Note that the numbers along the vertical axis of the graph still indicate power magnitude – efficiency is only indicated by color.  As expected, the efficiency increases asymptotically to 100% as load resistance increases (dark blue indicates 0% and dark red indicates close to 100%).

## Car Amplifier Reverse Polarity Repair

I wrote this up a long time ago, but never finished it until now.  I took pictures, but unfortunately it looks like I lost them during a hard drive failure.  But, here it goes anyway…

I recently fixed a broken car amplifier (Pyle brand) for a family member, and I wrote this up to document the results.

### Background

He was powering up the car amplifier after doing some re-wiring, and smoke came out of the amplifier.  The amplifier no longer worked after this.  He had earlier blown the fuses (there are two 30 amp fuses in parallel) and had bypassed them by wrapping a wire around the blades of one of the fuses.

### Diagnosis

After opening up the case, I saw that a diode had overheated and cracked open.  A fairly wide circuit board trace leading away from the fuse block had also overheated and had broken.  The broken diode was part of a reverse polarity protection circuit.  The circuit is shown here: When reverse polarity is applied to the amplifier power terminals, the diode protects the amplifier in two ways:

1. The diode clamps the voltage on the positive bus so that it does not swing too far negative (I would guess that it would not get below -1 or -2 V).
2. When the battery tries to lower the voltage further, a large current starts flowing through the diode.  This quickly causes the fuse to blow.  The blown fuse prevents damage to the diode or to the rest of the amplifier.

The family member said that he hooked up the amplifier correctly, but the blown diode tells a different story!  To be kind, there is a very small chance that the diode just happened to fail on its own at that particular moment…

I assume the sequence of events went like this:

1. Since the fuse had been bypassed, the diode continued to conduct longer than designed.  It overheated and failed closed (i.e. it shorted and became like a wire with very low resistance in both directions).  The diode is a 1N5401, which is only rated for 3 amps.
2. With the diode shorted, a high current continued to flow through the positive terminal of the amplifier, through the fuse block, through the diode, and out through the amplifier’s ground terminal.
3. The circuit board trace overheated and broke.

In a round-about way, the protection circuit worked.  The diode clamped the voltage and cut off power, and the circuit board trace acted as the fuse.  If the diode had failed open, the amplifier probably would have had more extensive damage.

On a side note: I am impressed with the circuit board design – there is a black mask on the top of the circuit board which mirrors the copper on the bottom.  This makes it easy to trace the circuit just by looking at the top component side.

### Repair

The repair was straight-forward.

1. I soldered in a replacement diode from Radio Shack.
2. To repair the circuit board, I first cut off the loose trace (which had come off the board after burning) with an exacto knife.  This was probably unnecessary, but I was nervous that the loose copper foil might eventually weaken or break.
3. I cut one of the blades off one of the blown fuses.  It was about the right width and length to replace the missing trace.
4. I soldered the blade across the circuit board gap.  I used a high wattage soldering gun for this.
5. I replaced the fuses.

After re-assembling the amplifier, it tested out OK and is working fine.