To understand the analysis of PWM (pulse width modulation) at a simple level consider the following input, a digital pulse train that is high 60% of the time, that goes into a system. The period of the function is "T". For this example we will take the high part of the signal to be 5, and the low part to be 0. Our goal is to find the output of the system.
First we note that the input to the system can be split into two parts, a constant part equal to a constant part (equal to the average) and a time varying part (with an average of zero), as shown.
Since the input is high (5) 60% of the time, the average is 0.6×5=0.3. The time varying part is equal to 2 for 60% of the time, and equal to -3 for 40% of the time, so its average is zero, as specified.
If the system is linear (we will only consider linear systems) we can say that the output of the system is equal to the sum of the response of the system to the constant (average) part, and the time varying (zero average) parts.
This has the advantage that the average system output is usually very easy (often trivial) to find, then we just have to make sure that the system is such that the time varying output is small (more on this later).
We will consider simple RC circuit with a PWM output. In this case the PWM input (vin(t)) alternates between 0V and 5V with a frequency of 1Hz (or period of 1S).
The graph below shows the behavior of the system throughout one cycle of the PWM output. The duty cycle, D, can be varied from 0 to 1 and is the fraction of time that the output is high. The time constant (τ=R·C) can also be varied, but the period of the input is fixed at T seconds. The graph shows the input (black), the output (translucent magenta), the average value (horizontal magenta line, its calculation is described below), and a simple linear approximation (dotted red line, also described below). Also shown are the slopes of the approximate output when the input is high, and when it is low, as well as the exact and approximate amount of ripple (ripple is the peak to peak variation in the output).
Try these things to get a feel for how the PWM works.
There will be two steps in the analysis.
To find the average output, we assume the input is a constant, Vin,ave. Assuming the input is constant, there are many ways to find the output; three easy methods are given below.
Try this on the demo (above):
Finding the ripple is usually straightforward if the system in question is first order, and the time constant, τ, of the system is much longer thatn the period, T, of the input signal oscillations. In this case we can assume that the system is slow enough that the output doesn't change much during one cyle of the input. Therefore, to determine the amount of ripple, let us assume that the output voltage is consant (at the average value of the input).. Note: This may seem a bit strange — we are using the assumption that the output is constant to find the amount of variation in the output. If you are interested in a more thorough derivation, check out the next page in this series.
Let's find the ripple when the duty cycle is 0.6. For this circuit the output voltage is just the average of the input, or 5·D=3V.
If the input is high (i.e., vin(t)=5) and the output is the average (3V), the voltage across the resistor is 5-3=2V, and the current (from left to right) through the resistor is 2V/R. We can now find the slope of the output
\[\begin{array}{l}
{i_R} = {i_C} = C\frac{{d{v_{out}}(t)}}{{dt}}\\
with\quad {i_R} = \frac{{{v_{in}} - {v_{out}}}}{R} = \frac{{{v_{in}} - {v_{ave}}}}{R} = \frac{{5 - 5 \cdot D}}{R}{\rm{, so}}\\
\frac{{d{v_{out}}(t)}}{{dt}} = \frac{{{i_R}}}{C} = \frac{{5 - 5 \cdot D}}{{R \cdot C}} = \frac{{5 \cdot (1 - D)}}{\tau }
\end{array}\]
The total amount of ripple is just this slope multiplied by the amount of time that the output is high (in this case D·T seconds). Note: In this case the period, T, is 1 second. Since this is the ripple in the output voltage while vin is high, we will call this Δvout,vin=1.
\[\Delta {v_{out,vin = 1}} = \frac{{5 \cdot (1 - D)}}{\tau } \cdot \Delta t = \frac{{5 \cdot (1 - D)}}{\tau } \cdot D \cdot T = 5 \cdot (1 - D) \cdot D \cdot \frac{T}{\tau }\]
Likewise, if the input is low (i.e., vin(t)=0) and the output is 3V, the voltage across the resistor is 0−3=−3V, and the current (from left to right) through the resistor is -3V/R. We can now find the slope of the output
\[\begin{array}{l}
{\rm{ }}{i_R} = \frac{{{v_{in}} - {v_{out}}}}{R} = \frac{{{v_{in}} - {v_{ave}}}}{R} = \frac{{0 - 5 \cdot D}}{R}{\rm{ = }} - \frac{{5 \cdot D}}{R}{\rm{, so}}\\
\frac{{d{v_{out}}(t)}}{{dt}} = \frac{{{i_R}}}{C} = - \frac{{5 \cdot D}}{{R \cdot C}} = - \frac{{5 \cdot D}}{\tau }
\end{array}\]
The total amount of ripple is just this slope multiplied by the amount of time that the output is high (in this case (1-D)·T seconds). Note: In this case the period, T, is 1 seconds. Since this is the ripple in the output voltage while vin is low, we will call this Δvout,vin=0.
\[\Delta {v_{out,vin = 0}} = - \frac{{5 \cdot D}}{\tau } \cdot \Delta t = - \frac{{5 \cdot D}}{\tau } \cdot \left( {1 - D} \right) \cdot T = - 5 \cdot D \cdot \left( {1 - D} \right) \cdot \frac{T}{\tau }\]
Try this on the demo (above):
As τ increases (so the ratio T/τ decreases), the ripple decreases. If we make τ large enough (compared to the period, T, of the PWM signal) the ripple goes to zero and the output is effectively constant.
Mathematical details are described in the next page in this series.