# Circuit Theory/Variables and Units

## Electric Charge (Coulombs)

**Electric charge** is a physical
property of
matter that causes it to experience a
force when near other electrically charged
matter. Electric Charge (symbol q) is measured in SI units called
**\"Coulombs\"**, which are abbreviated with the letter capital C.

We know that q=n\*e, where n = number of electrons and e= 1.6\*10^−19^.
Hence n=1/e coulombs. A Coulomb is the total charge of
6.24150962915265×10^18^ electrons, thus a single electron has a charge
of −1.602 × 10^−19^ C.

It is important to understand that this concept of \"charge\" is
associated with static electricity. Charge, as a concept, has a physical
boundary that is related to counting a group of electrons. \"Flowing\"
electricity is an **entirely different
situation**.
\"Charge\" and electrons separate. Charge moves at the speed of light
while electrons move at the speed of **1
meter/hour**. Thus in most circuit
analysis, \"charge\" is an abstract concept unrelated to energy or an
electron and more related to the flow of
**information**.

Electric charge is the subject of many fundamental laws, such as
**Coulomb\'s Law** and **Gauss\'
Law** (static electricity) but is not used
much in circuit theory.

## Voltage (Volts)

**Voltage** is a measure of the work required to move a charge from one
point to another in a electric field. Thus the unit \"volt\" is defined
as a Joules (J) per Coulomb (C).

$$V = \frac{W}{q}$$

W represents work, q represents an amount of charge. Charge is a static
electricity concept. The definition of a volt is shared between static
and \"flowing\" electronics.

Voltage is sometimes called \"electric potential\", because voltage
represents the a difference in Electro Motive Force (EMF) that can
produce current in a circuit. More voltage means more potential for
current. Voltage also can be called \"Electric Pressure\", although this
is far less common.

Voltage is not measured in absolutes but in *relative* terms. The
English language tradition obscures this. For example we say \"What is
the distance to New York?\" Clearly implied is the relative distance
from where we are standing to New York. But if we say \"What is the
voltage at \_\_\_\_\_\_?\" What is the starting point?

Voltage is defined between two points. Voltage is relative to where 0 is
defined. We say \"The voltage from point A to B is 5 volts.\" It is
important to understand EMF and voltage are two different things.

When the question is asked \"What is the voltage at \_\_\_\_\_\_?\",
look for the ground symbol on a circuit diagram. Measure voltage from
ground to \_\_\_\_\_. If the question is asked \"What is the voltage
from A to B?\" then put the red probe on A and the black probe on B (not
ground).

The absolute is referred to as \"EMF\" or Electro Motive Force. The
difference between the two EMF\'s is a voltage.

## Current (Amperes)

**Current** is a measurement of the flow of electricity. Current is
measured in units called **Amperes** (or \"Amps\"). An ampere is
\"charge volume velocity\" in the same way water current could be
measured in \"cubic feet of water per second.\" But current is a **base
SI unit**, a fundamental dimension of
reality like space, time and mass. A coulomb or charge is not. A coulomb
is actually defined in terms of the ampere. \"Charge or Coulomb\" is a
**derived SI
Unit**.
The coulomb is a fictitious entity left over from the **one fluid /two
fluid**
philosophies of the 18th century.

This course is about flowing electrical energy that is found in all
modern electronics. Charge volume velocity (defined by current) is a
useful concept, but understand it has no practical use in engineering.
Do not think of current as a bundle electrons carrying energy through a
wire. Special relativity and quantum
mechanics concepts are necessary to
understand how electrons move at **1
meter/hour** through copper, yet
electromagnetic energy moves at near the speed of light.

Amperes are abbreviated with an \"A\" (upper-case A), and the variable
most often associated with current is the letter \"i\" (lower-case I).
In terms of coulombs, an ampere is:

$$i = \frac{dq}{dt}$$

Because of the widespread use of complex numbers in Electrical
Engineering, it is common for electrical engineering texts to use the
letter \"j\" (lower-case J) as the imaginary number, instead of the
\"i\" (lower-case I) commonly used in math texts. This wikibook will
adopt the \"j\" as the imaginary number, to avoid confusion.

## Energy and Power

Electrical theory is about energy storage and the flow of energy in
circuits. Energy is chopped up arbitrarily into something that doesn\'t
exist but can be counted called a coulomb. Energy per coulomb is
voltage. The velocity of a coulomb is current. Multiplied together, the
units are energy velocity or power \... and the unreal \"coulomb\"
disappears.

### Energy

Energy is measured most commonly in Joules, which are abbreviated with a
\"J\" (upper-case J). The variable most commonly used with energy is
\"w\" (lower-case W). The energy symbol is w which stands for work.

From a thermodynamics point of view, all energy consumed by a circuit is
work \... all the heat is turned into work. Practically speaking, this
can not be true. If it were true, computers would never consume any
energy and never heat up.

The reason that all the energy going into a circuit and leaving a
circuit is considered \"work\" is because from a thermodynamic point of
view, electrical energy is ideal. All of it can be used. Ideally all of
it can be turned into work. Most introduction to thermodynamics courses
assume that electrical energy is completely organized (and has entropy
of 0).

### Power

A corollary to the concept of energy being work, is that all the
energy/power of a circuit (ideally) can be accounted for. The sum of all
the power entering and leaving a circuit should add up to zero. No
energy should be accumulated (theoretically). Of course capacitors will
charge up and may hold onto their energy when the circuit is turned off.
Inductors will create a magnetic field containing energy that will
instantly disappear back into the source through the switch that turns
the circuit off.

This course uses what is called the
\"passive\" sign
convention for power. Energy put into a circuit by a power supply is
negative, energy leaving a circuit is positive.

Power (the flow of energy) computations are an important part of this
course. The symbol for power is w (for work) and the units are Watts or
W.


# Circuit Theory/Circuit Basics

## Circuits

**Circuits** (also known as \"networks\") are collections of circuit
elements and wires. Wires are designated on a schematic as being
straight lines. Nodes are locations on a schematic where 2 or more wires
connect, and are usually marked with a dark black dot. Circuit Elements
are \"everything else\" in a sense. Most basic circuit elements have
their own symbols so as to be easily recognizable, although some will be
drawn as a simple box image, with the specifications of the box written
somewhere that is easy to find. We will discuss several types of basic
circuit components in this book.

## Ideal Wires

For the purposes of this book, we will assume that an ideal wire has
zero total resistance, no capacitance, and no inductance. A consequence
of these assumptions is that these ideal wires have infinite bandwidth,
are immune to interference, and are --- in essence --- completely
uncomplicated. This is not the case in real wires, because all wires
have at least some amount of associated resistance. Also, placing
multiple real wires together, or bending real wires in certain patterns
will produce small amounts of capacitance and inductance, which can play
a role in circuit design and analysis. This book will assume that all
wires are ideal.

## Ideal Junctions or Nodes

!Nodes are areas where the Electromotive Force is the
same.

Nodes are also called \"junctions\" in this book in order to make a
distinction between Node analysis, Kirchhoff\'s current law and
discussions about a physical node itself. Here a physical node is
discussed.

A junction is a group of wires that share the same electromotive
force (not voltage). Wires
ideally have no resistance, thus all wires that touch wire to wire
somewhere are part of the same node. The diagram on the right shows two
big blue nodes, two smaller green nodes and two trivial (one wire
touching another) red nodes.

Sometimes a node is described as where two or more wires touch and
students circle where wires intersect and call this a node. This only
works on simple circuits.

One node has to be labeled ground in any circuit drawn before voltage
can be computed or the circuit simulated. Typically this is the node
having the most components connected to it. Logically it is normally
placed at the bottom of the circuit logic diagram.

Ground is not always needed physically. Some circuits are
floated on purpose.

Node Quiz

## Measuring instruments

**Voltmeters and Ammeters** are devices that are used to measure the
voltage across an element, and the current flowing through a wire,
respectively.

### Ideal Voltmeters

An ideal voltmeter has an infinite resistance (in reality, several
megaohms), and acts like an open circuit. A
voltmeter
is placed across the terminals of a circuit element, to determine the
voltage across that element. In practice the voltmeter siphons enough
energy to move a needle, cause thin strips of metal to separate or turn
on a transistor so a number is displayed.

### Ideal Ammeters

An ideal ammeter has zero resistance and acts like a short circuit.
Ammeters require cutting a wire and plugging the two ends into the
Ammeter. In practice an ammeter places a tiny resistor in a wire and
measures the tiny voltage across it or the ammeter measures the
magnetic field strength generated by
current flowing through a wire. Ammeters are not used that much because
of the wire cutting, or wire disconnecting they require.

## Active, Passive & ReActive

The elements which are capable of delivering energy or which are capable
to amplify the signal are called \"Active elements\". All power supplies
fit into this category.

The elements which will receive the energy and dissipate it are called
\"Passive elements\". Resistors model these devices.

Reactive elements store and release energy into a circuit. Ideally they
don\'t either consume or generate energy. Capacitors, and inductors fall
into this category.

## Open and Short Circuits

### Open

No current flows through an open. Normally an **open** is created by a
bad connector. Dust, bad solder joints, bad crimping, cracks in circuit
board traces, create an **open**. Capacitors respond to DC by turning
into **opens** after charging up. Uncharged inductors appear as
**opens** immediately after powering up a circuit. The word **open** can
refer to a problem description. The word **open** can also help develop
an intuition about circuits.

Typically the circuit stops working with opens because 99% of all
circuits are driven by voltage power sources. Voltage sources respond to
an open with no current. Opens are the equivalent of clogs in plumbing
.. which stop water from flowing.

On one side of the open, EMF will build up, just like water pressure
will build up on one side of a clogged pipe. Typically a voltage will
appear across the open.

### Short

A voltage source responds to a **short** by delivering as much current
as possible. An extreme example of this can be seen in this ball
bearing motor video. The
motor appears as a short to the battery. Notice he only completes the
short for a short time because he is worried about the car battery
exploding.

Maximum current flows through a **short**. Normally a **short** is
created by a wire, a nail, or some loose screw touching parts of the
circuit unintentionally. Most component failures start with heat build
up. The heat destroys varnish, paint, or thin insulation creating a
**short**. The **short** causes more current to flow which causes more
heat. This cycle repeats faster and faster until there is a puff of
smoke and everything breaks creating an **open**. Most component
failures start with a **short** and end in an **open** as they burn up.
Feel the air temperature above each circuit component after power on.
Build a memory of what normal operating temperatures are. Cold can
indicate a short that has already turned into an open.

An uncharged capacitor initially appears as a **short** immediately
after powering on a circuit. An inductor appears as a **short** to DC
after charging up. The **short** concept also helps build our intuition,
provides an opportunity to talk about electrical safety and helps
describe component failure modes.

A **closed** switch can be thought of as short.
Switches are surprisingly complicated.
It is in a study of switches that the term **closed** begins to dominate
that of **short**.


# Circuit Theory/Resistors

## Resistors

Mechanical engineers seem to model everything with a spring. Electrical
engineers compare everything to a **Resistor**. Resistors are circuit
elements that resist the flow of current. When this is done a voltage
appears across the resistor\'s two wires.

A pure resistor turns electrical energy into
heat. Devices similar to resistors turn this energy into light, motion,
heat, and other forms of energy.

![](Resistor_schema.png "Resistor_schema.png")

Current in the drawing above is shown entering the + side of the
resistor. Resistors don\'t care which leg is connected to positive or
negative. The + means where the positive or red probe of the volt meter
is to be placed in order to get a positive reading. This is called the
\"positive charge\" flow
sign convention. Some circuit theory classes (often within a physics
oriented curriculum) are taught with an \"electron flow\" sign
convention.

In this case, current entering the + side of the resistor means that the
resistor is removing energy from the circuit. This is good. The goal of
most circuits is to send energy out into the world in the form of
motion, light, sound, etc.

## Resistance

**Resistance** is
measured in terms of units called \"Ohms\" (volts per ampere), which is
commonly abbreviated with the Greek letter Ω (\"Omega\"). Ohms are also
used to measure the quantities of *impedance* and *reactance*, as
described in a later chapter. The variable most commonly used to
represent resistance is \"r\" or \"R\".

Resistance is defined as:

$$r = {\rho L \over A}$$

where ρ is the resistivity of the material, L is the length of the
resistor, and A is the cross-sectional area of the resistor.

## Conductance

**Conductance** is the inverse of resistance. Conductance has units of
\"Siemens\" (S), sometimes referred to as mhos (ohms backwards,
abbreviated as an upside-down Ω). The associated variable is \"G\":

$$G = \frac{1}{r}$$

Before calculators and computers, conductance helped
reduce the number of hand calculations that
had to be done. Now conductance and it\'s related concepts of
admittance and susceptance can be
skipped with matlab, octave, wolfram alpha and other computing tools.
Learning one or more these computing tools is now absolutely necessary
in order to get through this text.

## Resistor terminal relation

right\|framed\|A simple circuit diagram relating current, voltage, and
resistance

The drawing on the right is of a battery and a resistor. Current is
leaving the + terminal of the battery. This means this battery is
turning chemical potential energy into electromagnetic potential energy
and dumping this energy into the circuit. The flow of this energy or
power is negative.

Current is entering the positive side of the resistor even though a +
has not been put on the resistor. This means electromagnetic potential
energy is being converted into heat, motion, light, or sound depending
upon the nature of the resistor. Power flowing out of the circuit is
given a positive sign.

The relationship of the voltage across the resistor V, the current
through the resistor I and the value of the resistor R is related by
ohm\'s law:

$$V=R*I$$

A resistor, capacitor and inductor all have only two wires attached to
them. Sometimes it is hard to tell them apart. In the real world, all
three have a bit of resistance, capacitance and inductance in them. In
this unknown context, they are called two terminal devices. In more
complicated devices, the wires are grouped into
ports. A two terminal device
that expresses Ohm\'s law when current and voltage are applied to it, is
called a resistor.

## Resistor Safety

Resistors come in all forms. Most have a maximum power rating in watts.
If you put too much through them, they can melt, catch fire, etc.
Resistance is an electrical passive element which oppose the flow of
electricity. Air can be considered as one of the resistances. Air is
used as a resistance in Lightning Arrestors. Also vacuum also is used as
a resistor.

## Example

Suppose the voltage across a resistor\'s two terminals is 10 volts and
the measured current through it is 2 amps. What is the resistance?

If $v=iR$ then $R = v/i = 10V/2A = 5 ohms$


# Circuit Theory/Capacitors

**Capacitors** are passive circuit elements
that can be used to store energy in the form of an electric field. In
the simplest case, a capacitor is a set of parallel metal plates
separated by a *dielectric* substance. Dielectric used can be air or any
other substance.

![](Capacitor.svg "Capacitor.svg"){width="200"}

Electric charges build up on the opposite plates as a voltage is applied
to the capacitor.

With a constant voltage across the capacitor there will be no change in
electric charge and thus the steady-state current becomes zero. Stored
energy can be discharged from a capacitor by connecting its terminals
with a wire. Big capacitors can create lightening bolts, so tape the
wire to the end of a long wooden stick.

### Capacitance

**Capacitance** is defined as the
capability of a capacitor to store the charge of a voltage. Capacitance
is measured in units called \"Farads,\" abbreviated by an \"F\".

The ratio of charge over voltage gives a value of capacitance

$$C = \frac{q}{v}$$

### Capacitor Terminal Relation

The relationship between the current and the voltage of a capacitor is:

$$i = C\frac{dv}{dt}$$

The real world disturbs a capacitor by changing the voltage across it
rapidly. This instantly turns the capacitor into a short. The capacitor
eventually catches up to the changed condition, the voltage stops
changing, the current drops to zero and the capacitor acts like an open.

### Capacitor Safety

The bigger a capacitor is, the more dangerous it is.

A capacitor can continue storing its energy after the circuit is turned
off. A capacitor the size of a soda bottle can throw a person across the
room and/or damage nerves. Touching a capacitor the size of a kitchen
trash destroyed a persons arms to the point they were cut off at the
shoulders. Touching a capacitor the size of an oil drum has killed
people. Super
capacitors are packing
more power into smaller, lighter objects.

If capacitor is connected to a circuit wrong, it can explode youtube
video.

A leyden jar is a capacitor. Aluminum foil
of about 200 mm by 450 mm placed on either side of glass can store
charge. If charged with a static electricity generator such as a
Wimshurst machine can cause the
glass, at the edges of the aluminum foil to shatter into little shards
like a grenade exploding.

### Example

Problem: Given a current of 10 amps flowing through a 1uF capacitor for
2 us, what is the voltage across the capacitor?

Solution: The problem appears to be a capacitor hit by a pulse of
current: $i(t) = \begin{cases}
 0, & \text{for } t {\leq} 0\\
 10, & \text{for } 0 < t {\leq} .000002\\
 0, & \text{for } .000002 < t
\end{cases}$

The initial voltage across the capacitor is not given. Assume it is zero
for time less than 0. While current is flowing into the capacitor it is
going to charge. When the current stops, the capacitor will hold it\'s
charge and the voltage will remain constant.

The charging period requires transforming\
$i = C\frac{dv}{dt}$\
into the integral\
$v(t) = \frac{\int\limits_{0}^{t}i({\tau})\,d{\tau}}{C}$

The solution involves an integral: $v(t) = \begin{cases}
 0, & \text{for } t {\leq} 0\\
 \frac{\int\limits_{0}^{t}10\,d{\tau}}{.000001}, & \text{for } 0 < t {\leq} .000002\\
 v(.000002), & \text{for } .000002 < t
\end{cases}$

To calculate the answer, the integral needs to be evaluated twice (links
are to wolfram alpha):

-   once with the limits
    0,t
-   second with the limits
    0,0.000002

This results in the solution$$v(t) = \begin{cases}
 0  \text{  volts}, & \text{for } t {\leq} 0 \text{  seconds}\\
 10^7t \text{  volts}, & \text{for } 0 < t {\leq} .000002 \text{  seconds}\\
 20 \text{  volts}, & \text{for } .000002 < t \text{  seconds}
\end{cases}$$


# Circuit Theory/Inductors

An **inductor** is a coil of wire that stores
energy in the form of a magnetic field. The magnetic field depends on
current flowing to \"store energy.\"

If the current stops, the magnetic field collapses and creates a spark
in the device that is opening the circuit. The large generators found in
electricity generation can create huge currents. Turning them off can be
dangerous MIT EMF Youtube
video. There are no dangers
storing them.

![](Inductor_diagram.svg "Inductor_diagram.svg")

### Inductance

**Inductance** is the capacity of an
inductor to store energy in the form of a magnetic field. Inductance is
measured by units called \"Henries\" which is abbreviated with a capital
\"H,\" and the variable associated with inductance is \"L\".

Inductance is the ratio of magnetic flux (symbol $\Phi_B$) to current:

$L = \Phi_B/i$

$\Phi_B$ measures the strength of a magnetic field just like charge
measures the strength of an electric field.

### Inductor Terminal Relation

The relationship between inductance, current, and voltage through an
inductor is given by the formula:

$$v = L\frac{di}{dt}$$

### Inductor Safety

Inductors found in power plants can store energy,
but inductors found at room temperature will not store energy. An
isolated inductor in storage can not kill someone like a capacitor can.

Inductors do cause problems. The first is economic. A good inductor is
much more expensive than a capacitor. In some situations, a collection
of other
components
can replace an inductor at less cost. Typical inductors are built with
copper which increases in cost as
supply on earth dwindles.

Inductors can create spikes and sparks
video when turning off that
can destroy other electrical components. They can destroy switches. They
can vaporize metal.

The biggest inductors at room temperature are found in electric motors.
When motors are turned on or off they create what is called a \"back
EMF.\" Ideally Back EMF is a voltage spike of
infinite voltage. Diodes, capacitors and resistors are used to turn the
back EMF into heat on discharge may make starting up the motor a
problem. Some electronic speed
controlers (ESCs) in
UAVs and quadcopters pulse the motor to
deliberately and measure the back EMF to figure out what direction the
motor is going to spin in. This reduces the need of hall-effect probes
and thus reduces the cost of the motor.

### Inductor Example

Question: Given the current through a 10mH inductor is
$i(t) = 5t*e^{-1000t}$ amps, what is the voltage?

Solution: No need to know the initial conditions because the solution is
a derivative: $v(t) = L di/dt$.

Using Wolfram
Alpha,
the solution is $v(t) = .01*e^{-1000t}(5-5000t)$ volts.


# Circuit Theory/Power supplies

## Sources

All sources can be alternating current (AC) or direct current (DC).

### Voltage Sources

Many power sources or supplies such as batteries or wall outlets are
voltage sources. This means they vary the current to keep the voltage
constant. AAA and AA batteries ideally put out 1.5 volts at all times.
Most of the time they are open (not connected to anything). Eventually
they are connected to a circuit that draws current from them. An ideal
AAA or AA battery could deliver infinite amount of current. A real world
battery tries to deliver infinite current if shorted, but usually heats
up, catches on fire or
explodes.

### Current Sources

Most consumers have never had an first hand experience with a current
source. Neither will most students in the first semester of Circuit
Theory course\'s lab section. Current sources are the opposite of
voltage sources: they keep the current constant by varying the voltage.
This makes them very dangerous.

Current sources would require a wire shorting them at all times. If the
shorting wire were removed, the ideal currents source would create the
biggest, scariest lightning bolt instantaneously.

Current sources are important conceptually in order to understand ideal
transistors and op amps. This is why they are part of circuit theory
from the very beginning. Working with current sources inside op amps and
transistors has few safety risks.

### Power Supply Terminal Relation

There is no relationship between the current voltage through a power
supply. A 5 volt DC power supply will vary it\'s current based upon the
circuit attached. A 5 Amp DC power supply will vary it\'s voltage based
upon the circuit attached.

A power supply is a dependent device \... dependent upon the independent
resistors, capacitors, inductors that are arranged in a circuit and
attached to it.

### Power/Energy Equations

At any given instant, the power flowing through a two terminal device
is: $p(t) = v(t)i(t)$

The average power being consumed during time t is:
$p_{avg}(t)= 1/t * \int\limits_{0}^{t}{\tau}*p({\tau})\, d{\tau}$\
If p(t) is Sinusoidal, then the upper limit is one time period.\
Remember that the period of $sin(wt+{\theta})$ is $2{\pi}/w$

The energy consumed or work done during time t is similar:
$w(t)= \int\limits_{0}^{t}p({\tau})\, d{\tau}$

All other power concepts derive from the above. For example:

-   If the voltage and current are constant (DC), then
    $p(t) = p_{avg}(t) = iv = i^2R = v^2/R$
-   If the voltage and current are Sinusoidal (AC) and enough time has
    passed that the circuit is steady state, then math can be
    simplified, but first have to learn phasors. However there are peak
    power, average power and power factor concepts that need to be
    understood to develop an intuition about circuits and understand the
    fictitious \"flux
    capacitor\".
-   If the voltage and current are in any pattern and are steady state,
    then the above math can be simplified.

### Power Supply Safety

There are many different types of power supplies that each have
different safety concerns. LiPo batteries can explode/catch on
fire if
over charged. Here is a
video of someone exploring
244 dead 9 volt batteries creating a 2000 volt power supply. If shorted,
voltage supplies can do the same. If opened, current sources (very rare)
can do the same.

In most labs, the power supplies are protected by a fuse like a home is.
Shorts cause a circuit breaker to trip, fuse to burn out, relay to cut
off the circuit, etc. But batteries are typically not protected.

Most power supplies just stop working.

### Example 1

Find the average power consumed by a 20 ohm resistor when a current
$i(t) = \frac{4}{3}sin(3t)$ is applied.

Solution:

Assume the initial average power is 0. Actually this makes no rational
sense. But every time an integral is computed, consider the possibility.

$v(t) = i(t)*r$ \...\... from resistor terminal relation\
$p(t) = i(t)*v(t)=i(t)*i(t)*r = i(t)^2*r$ \..... from definition of
power\
$p_{avg}=\frac{1}{t}\int\limits_{0}^{t}{\tau}*i({\tau})^2*r\, d{\tau}$
\...\... average power definition\
$t=\frac{2\pi}{3}$ \.... definition of period\
$p_{avg} = \frac{20*3}{2\pi}\int\limits_{0}^{\frac{2\pi}{3}}{\tau}*(\frac{4}{3}sin(3{\tau}))^2\, d{\tau} = 8.36 watts$
\... using
wolfram

### Example 2

Given the two graphs of voltage and current, find and graph the power
and energy for t=0 to t=8. !created with
desmos
!created with
desmos
!created with
desmos

Solution:

#### Turn the Question into Math

convert the voltage and current graphs to equations:
$v(t) \text{,  } i(t) = \begin{cases}
 v=0 \text{,  } i=0, & \text{for } t {\leq} 0\\
 v=2 \text{,  } i=2, & \text{for } 0 < t {\leq} 2\\
 v=2-2*(t-2) \text{,  } i=-2, & \text{for } 2 < t {\leq} 4\\
 v=-2 \text{,  } i=2, & \text{for } 4 < t {\leq} 5\\
 v=2*(t-5)-2 \text{,  } i=2, & \text{for } 5 < t {\leq} 6\\
 v=2*(t-5)-2 \text{,  } i=-2, & \text{for } 6 < t {\leq} 7\\
 v=2 \text{,  } i=-2, & \text{for } 7 < t {\leq} 8\\
\end{cases}$

#### Find the Power by Multiplying

Now do the math $p(t)=v(t)i(t)$ to find the power:

$p(t) = \begin{cases}
 0, & \text{for } t {\leq} 0\\
 4, & \text{for } 0 < t {\leq} 2\\
 4*(t-2)-4, & \text{for } 2 < t {\leq} 4\\
 -4, & \text{for } 4 < t {\leq} 5\\
 4*(t-5)-4, & \text{for } 5 < t {\leq} 6\\
 4-4*(t-5), & \text{for } 6 < t {\leq} 7\\
 -4, & \text{for } 7 < t {\leq} 8\\
\end{cases}$

#### Find the Energy by Integrating

Now comes the more difficult part. Energy
$w(t)= \int\limits_{0}^{t}{\tau}*p({\tau})\, d{\tau}$. Integrate from
the initial condition to t rather than a specific value. Evaluate the
integrals using wolfram
alpha.

$w(t) = \begin{cases}
 0, & \text{for } t {\leq} 0\\
 \int\limits_{0}^{t}4\, d{\tau}= 4t, & \text{for } 0 < t {\leq} 2\\
 \int\limits_{2}^{t}(4*({\tau}-2)-4)\, d{\tau}=2(t^2-6t+8), & \text{for } 2 < t {\leq} 4\\
 \int\limits_{4}^{t}(-4)\, d{\tau}=-4(t-4), & \text{for } 4 < t {\leq} 5\\
 \int\limits_{5}^{t}(4*({\tau}-5)-4)\, d{\tau}=2(t^2-12t+35), & \text{for } 5 < t {\leq} 6\\
 \int\limits_{6}^{t}(4-({\tau}-5)*4)\, d{\tau}=-2(t-6)^2, & \text{for } 6 < t {\leq} 7\\
 \int\limits_{7}^{t}(-4)\, d{\tau}=-4(t-7), & \text{for } 7 < t {\leq} 8\\
\end{cases}$

#### Find the integration constant and next initial condition

Find the first initial condition from the problem statement. Setting
beginning t to the initial condition and find the integration constant.
Find the next initial condition by setting the t to the end value of the
defined segment.

The goal is to find the cumulative energy, not the change in energy of
each segment. This is done by making sure that the end point of the
previous segment matches the value at the beginning of the next segment.
When graphed, there should be no vertical jumps.

$w(t) = \begin{cases}
 0 \text{ the assumed initial condition}, & \text{for } t {\leq} 0\\
 2(0)^2 + C = 0 \Rightarrow C=0 \text{ and } 4*2+0 = 8, & \text{for } 0 < t {\leq} 2\\
 2(2^2-6*2+8) + C = 8 \Rightarrow C=8 \text{ and } 2(4^2-6*4+8) + 8 = 8, & \text{for } 2 < t {\leq} 4\\
-4*(4-4) + C = 8 \Rightarrow C=8 \text{ and } -4*(5-4)+8 = 4, & \text{for } 4 < t {\leq} 5\\
 2*(5^2-12*5+35) + C = 4 \Rightarrow C=4 \text{ and } 2(6^2-12*6+35)+4 = 2, & \text{for } 5 < t {\leq} 6\\
-2(6-6)^2 + C = 2 \Rightarrow C= 2 \text{ and } -2(7-6)^2 + 2 = 0, & \text{for } 6 < t {\leq} 7\\
-4(7-7) + C = 0 \Rightarrow C=0 \text{ and } -4(8-7) +0 = -4, & \text{for } 7 < t {\leq} 8\\
\end{cases}$

#### Graphing and Checking the Solution

!energy in joules versus time in seconds
desmos
Graphing is a form of checking your work. Without graphing, the
intuitive process can not kick in.

$w(t) = \begin{cases}
 0, & \text{for } t {\leq} 0\\
 4t, & \text{for } 0 < t {\leq} 2\\
 2(t^2-6t+8)+8, & \text{for } 2 < t {\leq} 4\\
-4(t-4)+8, & \text{for } 4 < t {\leq} 5\\
2(t^2-12t+35)+4, & \text{for } 5 < t {\leq} 6\\
-2(t-6)^2+2, & \text{for } 6 < t {\leq} 7\\
-4(t-7), & \text{for } 7 < t {\leq} 8\\
\end{cases}$

#### Building Intuition

When doing a long problem like this one, it is important to build one\'s
intuition. There are two basic ways to do this:

-   Think about power supply experiences and ask \"What does this
    imply?\"
-   Add expectation feelings and emotion. Think of experiences, the
    emotion, the happening, not the end product of things you like.
    Attach the emotion associated with them to the problem at hand. Mix
    the doing them with solving the problem.
-   Tell a story, then check the story against the graphs.

What kind of device are we looking at? Has to be an element that both
consumes and generates electricity. The current is switching back and
forth every two seconds, thus it is most likely a motor driving some
kind of back and forth motion. Motors are essentially an inductor. An
inductor is going to vary the voltage all over the place to try and keep
the current constant \... like a current source. The motor is working as
planned (consuming energy) for the first four seconds sort of. During
the second four seconds, something else is happening. It looks like a 2
year old has grabbed the fan that is trying to oscillate back and forth
and is forcing it in the opposite direction. This could cause the motor
to turn into a generator, hence the voltage variations, the negative
energy and power.


# Circuit Theory/TR

A terminal is a place where a wire comes out of an electrical component.

Terminal relations for the 2 wire devices studied so far (resistors,
capacitors and inductors), describe the voltage across the two terminals
and the current entering and leaving the terminals (which is always the
same).

The terminal relations for a resistor are $v = i * R$ (called ohms law)

The terminal relations for a capacitor are $i = C * dv/dt$

The terminal relations for an inductor are $v = L * di/dt$

A power supply doesn\'t have a terminal relationship or equation
relating current and voltage. Either the current is constant (current
supply) or voltage is constant (voltage supply). The power is varied
depending upon what the circuit asks for.

One of the best places to build up your intuition or build your own
animated circuit simulations is at
falstad


# Circuit Theory/IV curves

!The current--voltage characteristics of four devices: 100K ohm, 10
ohm, a P--N junction diode, and a battery with real world internal
resistance. The horizontal axis is voltage drop, the vertical axis is
current.{width="450"}
These curves reflect that most circuits are designed with voltage as the
independent variable; with voltage sources and currents being dependent
variables. What this means is that the slopes of the IV curves are 1/R.
So normally whereas normally horizontal is a slope of 0, it is now a
slope of infinity.

Ideally, a diode would turn on at 0 volts and go from horizontal to
vertical instantly.

Ideally, a voltage source would be a vertical line.

Ideally, resistance does not change due to voltage or current and are
thus straight lines.

!transistor curves{width="400"}

A transistor is understood through the above type of graph. The
horizontal lines represent current source behavior. Notice how the
current stays constant while the voltage changes.

The angled straight lines coming out of the origin represent \"linear\"
behavior where the transistor is operating like an amplifier. The
horizontal lines are where the \"linear\" behavior stops and the current
source behavior begins.

Understanding what is controlling this and why the many blue lines
starts with understanding what the three wires into a transmitter do:

!Three wires into a
transistor{width="400"}

-   S = source (of power .. connect to a voltage source)
-   G = gate (like the switch of a light switch .. more like a dimmer
    knob)
-   D = drain (current leaves .. connected to ground)
-   B = Body \... (often connected to the source)

Think of S and D as the wires going into a light switch and G as the
dimmer knob. Each blue line represents a position of the dimmer switch.
The gate or dimmer switch determines the amount of amplification and the
value of the current source behavior.

So what are the dependent and independent variables above? There are two
independent variables: gate V~g~ and source voltage V~s~. Right now it
is not important to understand how V~g~ is physically measured. The
important question is \"What is the nature of the current source
behavior? It seems to be dependent on two things.\" An ideal,
independent current source manipulates the voltage to keep the current
constant. The current source behavior above is dependent upon the Gate.

The symbols for a transistor are:


# Circuit Theory/Transistor symbols

## Circuit symbols

There are lots of different types of transistors. The most popular is a
MOSFET and within this family there are lots of possibilities. The goal
right now is not to understand the differences and what all the lines
mean. Look at them and see that normally there are three wires
associated with them.

  ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------- ---------------------------------------------------------------- ---------------------------------------------------------------------------- -----------
  ![](JFET_P-Channel_Labelled.svg "JFET_P-Channel_Labelled.svg"){width="80"}   ![](IGFET_P-Ch_Enh_Labelled.svg "IGFET_P-Ch_Enh_Labelled.svg"){width="80"}   ![](IGFET_P-Ch_Enh_Labelled_simplified.svg "IGFET_P-Ch_Enh_Labelled_simplified.svg"){width="80"}   ![](Mosfet_P-Ch_Sedra.svg "Mosfet_P-Ch_Sedra.svg"){width="80"}   ![](IGFET_P-Ch_Dep_Labelled.svg "IGFET_P-Ch_Dep_Labelled.svg"){width="80"}   P-channel
  ![](JFET_N-Channel_Labelled.svg "JFET_N-Channel_Labelled.svg"){width="80"}   ![](IGFET_N-Ch_Enh_Labelled.svg "IGFET_N-Ch_Enh_Labelled.svg"){width="80"}   ![](IGFET_N-Ch_Enh_Labelled_simplified.svg "IGFET_N-Ch_Enh_Labelled_simplified.svg"){width="80"}   ![](Mosfet_N-Ch_Sedra.svg "Mosfet_N-Ch_Sedra.svg"){width="80"}   ![](IGFET_N-Ch_Dep_Labelled.svg "IGFET_N-Ch_Dep_Labelled.svg"){width="80"}   N-channel
  JFET                                                                         MOSFET enh                                                                   MOSFET enh (no bulk)                                                                               MOSFET dep
  ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------- ---------------------------------------------------------------- ---------------------------------------------------------------------------- -----------


# Circuit Theory/Dependent sources

!The four types of dependent sources \... the control variable is on
the left, the output variable is on the
right{width="500"}

Electronic amplifiers use two variables: current and voltage. Either can
be used as input, and either as output leading to four types of
amplifiers. In idealized form they are represented by each of the four
types of dependent source used in linear analysis, as shown in the
figure, namely:

  Input   Output   Dependent source                             Amplifier type
  ------- -------- -------------------------------------------- ----------------------------

  **I**   **I**    current controlled current source **CCCS**   current amplifier

  **I**   **V**    current controlled voltage source **CCVS**   transresistance amplifier

  **V**   **I**    voltage controlled current source **VCCS**   transconductance amplifier

  **V**   **V**    voltage controlled voltage source **VCVS**   voltage amplifier

Each type of amplifier in its ideal form has an ideal input and output
resistance that is the same as that of the corresponding dependent
source:[^1]

  Amplifier type         Dependent source   Input impedance   Output impedance
  ---------------------- ------------------ ----------------- ------------------

  **Current**            **CCCS**           **0**             **∞**

  **Transresistance**    **CCVS**           **0**             **0**

  **Transconductance**   **VCCS**           **∞**             **∞**

  **Voltage**            **VCVS**           **∞**             **0**

In practice the ideal impedances are only approximated. For any
particular circuit, a small-signal analysis often is used to find the
impedance actually achieved. A small-signal AC test current *I~x~* is
applied to the input or output node, all external sources are set to
zero, and the corresponding alternating voltage *V~x~* across the test
current source determines the impedance seen at that node as *R = V~x~ /
I~x~*.

## References

[^1]: It is a curiosity to note that this table is a \"Zwicky
    box\"; in particular, it
    encompasses all possibilities.


# Circuit Theory/Operational Amplifiers

!22 transistors making up an operational
amplifier
An operational amplifier is a circuit of about 22 transistors organized
with the goal of producing an amplifier.

$$V_{\!\text{out}} = A_{OL} \, (V_{\!+} - V_{\!-})$$

Ideally the open loop gain (A~OL~) is infinite. In reality the output
will \"rail\" to either the positive or negative supply.

Open loop means that there are no devices connecting the output to the
inverting input (- or negative input). In practice most op-amps are used
in \"closed-loop\", \"negative feedback\" configuration. Closed loop
designs (in the first approximation) require remembering two \"golden
rules\":

:   I. The output attempts to do whatever is necessary to make the
    voltage difference between the inputs zero.
:   II\. The inputs draw no current.

  Op-amp                                                                        Pins                                                                        Symbol
  ----------------------------------------------------------------------------- --------------------------------------------------------------------------- -------------------------------------------------------
  ![](Schematics_voltampopamp.jpg "Schematics_voltampopamp.jpg"){width="100"}   ![](Generic_741_pinout_top.png "Generic_741_pinout_top.png"){width="300"}   ![](Opamppinouts.png "Opamppinouts.png"){width="200"}

## Subtraction

!Subtraction or \"Differential
Amplifier\"
Under the condition that the *R*~*f*~ /*R*~1~ = *R*~*g*~ /*R*~2~, the
output expression becomes:

$$V_{\text{out}} = \frac{ R_{\text{f}} }{ R_1 } (V_{\text{2}} - V_{\text{1}})\,$$
\"A\" is the *differential gain* of the circuit.

## Operating Point

Op Amps are balanced:

:

    :   The supplies are +V and -V, not V_s and ground. This is why many
        power supplies have both +15 and -15 volts or +5 and -5 volts.
    :   They are made with almost equal numbers of PNP and NPN
        transistors.
    :   They are best operated where the output is around 0 volts.

Don\'t try to fit them into a digital circuit.

## Typical Applications

Op Amps are typically
used to amplify.

!Non-Inverting
!Inverting Vacuum tubes
(light bulbs with a grid and three wires) (1907 by Lee De
Forest) solved the existing need for
amplification of a weak data signal. But vaccuum tubes broke in less
than a year. Many famous scientist/engineer\'s first experience with
technology was radio
repair
including Feynman and
Armstrong.

Transistors came next in 1951 created by
Shockley. They enabled the transistor
radio \... that could be held in the palm of one\'s hand. Transistors
replaced vacuum tubes in almost all devices.

Operational Amplifiers emerged out of math, not inventor work shops.
They emerged from the needs that MatLab fills today, not a simple
calculator. Attempts were made to build them with vaccum tubes and every
known transistor. The 741 op amp took until transistors matured .. 1968.
The 741 is still in production. Op amps are found where the difference
between two devices sensing the environment are needed. They are used to
replace
inductors
in circuits because they are cheaper and lighter.

## Inverting or Not?

Op amps are drawn with the non-inverting input on top if the design goal
is an output that same polarity as the input. Why isn\'t it just called
\"positive input\"? Why isn\'t positive always on top?

The reason is that most op amps involve negative feedback. Most designs
require circuitry to be connected to the \"inverting\" input. If
possible the \"non-inverting\" input is grounded. This means that the
sweet middle operating point is more plausible.

But the most important reason comes from multiple op amp designs. The
negative or positive nature of the output can be more easily seen if the
inverting and non-inverting inputs flip based upon the immediate output
design intention. Negative output means that eventually a final op amp
may be needed to flip the output positive.

## Local Feedback

Op amp circuits are easy to design as long as the feedback is kept local
\... meaning the feedback loops back over only one local op amp. The
feedback does not span outputs. Only outputs connected to inputs connect
two op amps.

## Buffer

!buffer
configuraton
Buffers are needed to re-invigorate a signal.
Fanout is when an output is connected to too many
inputs. Buffers can restore the power needed to drive the rest of the
circuit.

## Adder

!Adder
configuration A
adder sums several (weighted) voltages:

$$V_{\text{out}} = -R_{\text{f}} \left( \frac{V_1}{R_1} + \frac{V_2}{R_2} + \cdots + \frac{V_n}{R_n} \right)$$

When $R_1 = R_2 = \cdots = R_n$, and $R_{\text{f}}$ independent

$$V_{\text{out}} = -\frac{R_{\text{f}}}{R_1} ( V_1 + V_2 + \cdots + V_n ) \!\$$

When $R_1 = R_2 = \cdots = R_n = R_{\text{f}}$

$$V_{\text{out}} = -( V_1 + V_2 + \cdots + V_n ) \!\$$

## Integrator

!integrator

$$V_{\text{out}} = -\int_0^t \frac{ V_{\text{in}} }{RC} \, \operatorname{d}t + V_{\text{initial}}\,$$

(where $V_{\text{in}}$ and $V_{\text{out}}$ are functions of time,
$V_{\text{initial}}$ is the output voltage of the integrator at time *t*
= 0.)

There are several potential problems with this circuit.

-   It is usually assumed that the input $V_{\text{in}}$ has zero DC
    component (i.e., has a zero average value). Otherwise, unless the
    capacitor is periodically discharged, the output will drift outside
    of the operational amplifier\'s operating range.
-   Even when $V_{\text{in}}$ has no offset, the leakage or bias
    currents into the operational amplifier inputs can add an unexpected
    offset voltage to $V_{\text{in}}$ that causes the output to drift.
    Balancing input currents **and** replacing the non-inverting ($+$)
    short-circuit to ground with a resistor with resistance $R$ can
    reduce the severity of this problem.
-   Because this circuit provides no DC feedback (i.e., the capacitor
    appears like an open circuit to signals with $\omega = 0$), the
    offset of the output may not agree with expectations (i.e.,
    $V_{\text{initial}}$ may be out of the designer\'s control with the
    present circuit).
-   The initial voltage is typically enforced by a power supply in
    parallel with the capacitor that is switched out of the circuit at
    t=0.

Many of these problems can be made less severe by adding a *large*
resistor $R_F$ in parallel with the feedback capacitor. At significantly
high frequencies, this resistor will have negligible effect. However, at
low frequencies where there are drift and offset problems, the resistor
provides the necessary feedback to hold the output steady at the correct
value. In effect, this resistor reduces the DC gain of the
\"integrator\" -- it goes from infinite to some finite value $R_F/R$.

## Differentiator

!Differentiator

This circuit differentiates the (inverted) signal over time.

$$V_{\text{out}} = -RC \,\frac{\operatorname{d}V_{\text{in}} }{ \operatorname{d}t}$$

## Inductor Replacement

!Gyrator .. replaces an
inductor

Simulates an inductor. The circuit exploits the fact that the current
flowing through a capacitor behaves through time as the voltage across
an inductor. The capacitor used in this circuit is smaller than the
inductor it simulates and its capacitance is less subject to changes in
value due to environmental changes.

This circuit is unsuitable for applications relying on the input
impedance seen left to right and indicated by the red $Z_{in}$ symbol is
the same in both circuits. The output on the left could tell the
difference between the op amp circuit and an inductor.

Of course there would not be a magnetic field (for a motor or
transformer) and any application relying on back
EMF would not work.


# Circuit Theory/Analog Computer

## Goal

Design an analog computer that generates
a solution to this differential equation:

$$a_2{d^2 v(t) \over dt^2} + a_1{d v(t) \over dt} + a_ov(t) = f(t)$$

:   f(t) is the input, the bump the car is going over
:   v(t) is the output, the vertical motion of the car in response to
    the bump
:   a~2~ is related to the spring constant of a shock absorber
:   a~1~ is related to the damping coefficient and viscosity of the oil
:   a~o~ is varied depending upon the desired ride

```{=html}
<!-- -->
```

:   The goal is to vary a~2~, a~1~, and a~o~ electronically, rather than
    build many models physically. This is modeling as done before WWII
    instead of using matlab or similar software.

```{=html}
<!-- -->
```

:   Modern applications of this include control systems (opening and
    closing valves in an industrial process, turning off and on motors,
    controlling a nuclear power plant).

## Organizing

At first glance, need 6 op-amps, 2 for differentiation, 3 for scaling, 1
for adding.

But the adder can do scaling also.

Need to think about the overall circuit design too. The desired output
is v(t). The function f(t) is an input. The derivatives are temporary
values that are built from the output being feed back. So the math is
going to look something like this:

$$\frac{a_2}{a_o}{d^2 v(t) \over dt^2} + \frac{a_1}{a_o}{d v(t) \over dt} -\frac{1}{a_o}f(t) = v(t)$$

Need to feed the output back into the input also \... and will take
first derivative, then second, then feed into the adder with f(t). So
the math would look more like this:

$$-(-\frac{a_1}{a_o}{d v(t) \over dt} - \frac{a_2}{a_o}{d^2 v(t) \over dt^2} + \frac{1}{a_o}f(t)) = v(t)$$

<File:Op-Amp> Differentiating Amplifier.svg\|this takes the input and
differentiates it so output is $-{d v(t) \over dt}$
<File:Op-Amp_Inverting_Amplifier.svg%7Cthis> takes output of the first
derivative which is negative and makes it positive again, so the second
derivative will be negative also <File:Op-Amp> Differentiating
Amplifier.svg\|this generates the second derivative
${d^2 v(t) \over dt^2}$ which is now negative like the first derivative
<File:Op-Amp> Summing Amplifier.svg\|this will take the negative
${d v(t) \over dt}$ and the negative (because was inverted)
$-{d^2 v(t) \over dt^2}$ terms and adds them to a positive f(t), scaling
appropriately to generate $v(t)$

## Simulating

![](ShockAbsorber1.png "ShockAbsorber1.png") Assume the output of OA4 is
v(t).

Then the output of OA1 is:

$$-R_1C_1{d v(t) \over dt}$$

The output of OA2 is:

$$-\frac{R_3}{R_2}(-R_1C_1{d v(t) \over dt}) = \frac{R_3R_1}{R_2}C_1{d v(t) \over dt}$$

The output of OA3 is:

$$-R_4C_2{d (\frac{R_3R_1}{R_2}C_1{d v(t) \over dt}) \over dt} = -\frac{R_4R_3R_1}{R_2}C_1C_2{d^2 v(t) \over dt^2}$$

Assume V~14~ is f(t). Then the output of OA4, the adder is:

$$-R_8(\frac{f(t)}{R_7} + \frac{-\frac{R_4R_3R_1}{R_2}C_1C_2{d^2 v(t) \over dt^2}}{R_5} + \frac{-R_1C_1{d v(t) \over dt}}{R_{56}}) = \frac{R_8R_1}{R_{56}}C_1{d v(t) \over dt} + \frac{R_8R_4R_3R_1}{R_5R_2}C_1C_2{d^2 v(t) \over dt^2} - \frac{R_8}{R_7}f(t)$$

Comparing this to:

$$\frac{a_1}{a_o}{d v(t) \over dt} + \frac{a_2}{a_o}{d^2 v(t) \over dt^2} - \frac{1}{a_o}f(t) = v(t)$$

We can see that:

$$\frac{a_1}{a_0} = \frac{R_8R_1}{R_{56}}C_1$$

$$\frac{a_2}{a_o} = \frac{R_8R_4R_3R_1}{R_5R_2}C_1C_2$$

$$\frac{1}{a_0} = \frac{R_8}{R_7}$$

There are three knowns a~0~, a~1~, and a~2~, 10 unknowns and 3
equations. So the problem is under constrained, meaning that other
requirements can be used to pick the resistor and capacitor values.


# Circuit Theory/Circuit Definition

Circuit Analysis is reverse engineering. Given a circuit, figure out the
currents, voltages, and powers associated with each component. The
project or problem that produced the circuit or the purpose of the
circuit is not of concern. Most circuits are designed to illustrate a
concept or practice the math rather than do something useful. Towards
the end of this book, the \"useful\" circuits are studied that related
to wireless communication.

### Untangle

First untangle a circuit. Flatten into two dimensions. Put all the
components in the same orientation: up and down.

### Naming

This is an exercise in naming unknowns. There are only two things to
remember:

-   Devices in series share the same current.
-   Devices in parallel share the same voltage.

The consequence of not doing this is merely another simple equation to
write down and solve.

Now name the voltages and currents following these rules:

-   Name series voltage with the same subscript as the component such as
    $v_{r1} v_{c1} v_{L1}$. Choose a different naming convention for the
    shared voltage of parallel components such as $v_1 v_2$. Do not
    guess the polarity of the voltage yet.
-   Name the parallel currents with the same subscript as the component
    such as $i_{r1} i_{c1} i_{L2}$. Choose a different subscript for the
    shared current of series circuits such as $i_1 i_2$. Don\'t put
    arrow heads on wires yet indicating current direction.
-   Don\'t forget to put voltages across current sources and name
    currents coming out of voltage sources.

### Loops

Loops are the smallest circles of components. Count them. Don\'t count
\"loops containing loops\" or \"loops of loops.\" Say there are 3 loops.
Now any three loops of components can be considered (including loops
containing loops) that follow this rule: *Collectively each component
must be mentioned in a loop at least once.*

Some loops are trivial. Components in parallel will form a loop, but
they share the same voltage. If you call them a loop, then you will end
up with an equation that says $V_{r1} -V_{r2}=0$. Don\'t count trivial
loops unless you can not see devices sharing the same EMF difference.

Draw a loop with a different color pen and name the loop something like
$L_1 L_2 L_3$. Put an arrowhead describing the direction of the loop.
Now go around the loop in the chosen direction, put a + on the wire
entering each component and - on the wire leaving the component.

Current supplies in parallel with a component will share the same
voltage as the component so nothing needs to be done.

Current supplies without a parallel component will need a voltage
assigned to them. The polarity doesn\'t matter. But a polarity has to be
chosen.

Voltage supplies can be symbolized by alternating plates (long and
short) or a circle with + and - in it. Assign + to the long plate, and -
to the short plate. Otherwise use the + and - in the voltage source
symbol.

If two loops overlap, leave the first + and -. Don\'t put conflicting +
and - signs on the same component.

Don\'t use the word \"mesh\" here. \"Mesh analysis\" is covered later.
It is a different type of analysis that is not as general, but often is
much easier than Kirchhoff\'s Law. Kirchhoff\'s Law always works and is
described next.

### Junctions

A \"junction\" is a collection of wires at the same
EMF
(not voltage .. electro motive force is an absolute, voltage is
relative). Wires touching each other have the same energy per charge
(EMF) in them. Junctions stop at any component.

Some \"Junctions\" are trivial. These are the junctions where a single
wire connects only two components. Don\'t count these unless you can not
identify series components \"sharing\" a current.

Count the \"non-trivial\" \"Junctions.\" Say there are 3. Subtract 1.
This makes 2. You can write two junction equations. There typically more
than 2 possible junction equations. Make sure the two written mention
all the currents at least once.

At this point equations can be written around a node or a \"cut
set\" which is similar to at big loop with
smaller loops within it. Explore the electrical version of cut sets
here. They can make analyzing just part of a
circuit easier (discussed later). Again the equations have to include
each unknown current at least once.

Name the \"Junctions\" with symbols like $J_1 J_2$.

Now put arrow heads for current direction for passive (resistors) and
reactive (capacitors and inductors) components based upon the voltage
polarity. The current should move from + to -. The arrow head should be
into the + and out of the -.

Current sources will already have a current direction.

Voltage sources with a series component share the same current. The
direction of this current is determined by the voltage polarity on the
component.

Voltage sources that don\'t have a series component can be given current
in any direction. Remember that the polarity of these voltages and
currents is capturing the circuit topology, not predicting the polarity
of the ultimate numeric answer.

Don\'t use the word \"node\" here. \"Node analysis\" is covered later.
It is a different type of analysis that is not as general, but often is
much easier than Kirchoff\'s Law. Kirchoff\'s Law always works and is
described later.


# Circuit Theory/Kirchhoff's Law

Kirchhoff\'s law is a method of finding the voltage across every device
and the current through every device. It takes into account the circuit
topology (series/parallel), multiple sources, sources of different
types, and components of different types.
Technician courses spend a lot of time
developing an intuition that will eventually lead to an expertise that
is beyond the \"design, theory, science\" scope of this course.

Kirchhoff\'s law always works. It is the basis of all simulation
software. The goal here is to be able to check, to develop estimations,
and build up one\'s trust/understanding of simulation
software.

Kirchhoff\'s law starts with a drawing. The drawing is of a circuit that
is labeled with voltage polarities and current directions, with loops
and junctions as described earlier. Kirchhoff\'s circuit analysis can
not start without this drawing.

The circuit may be an existing one that is reversed engineered. The
circuit may be a thought experiment that is exploring alternatives.
Resistance, Capacitance, Inductance, and any voltage or current, any
source voltage or current may be an unknown.

For every unknown, there needs to be an equation according to linear
algebra. Kirchhoff\'s laws find equations in
three places:

-   Terminal Relations
-   Loops
-   Junctions

### Counting knowns and unknowns

Look at the drawing and write down the symbols for each known and
unknown. If an unknown write $= ?$ it. If a known, write
$= value {       ..} units$ next to it.

Power supply values should be assigned symbols such as
$V_{s1} V_{s2} I_{s1} I_{s2}$ and then given values if they are known.

Count the number of unknowns. A component value (resistance,
capacitance, inductance), a voltage or a current can be an unknown. This
is how many equations there need to be.

Count the number of components. Add the number of loops and junctions.
This is how many equations there are. If the number of unknowns doesn\'t
match, there is a problem.

If there are too many equations, there are two possibilities:

-   problem is over constrained (a fixed numerical constant needs to be
    made variable, a requirement needs to be renegotiated in the design
    process)
-   there is a dependent equation (much more difficult, this is why
    there are all the rules for sign, direction, counting loops and
    junctions)

If there are too many unknowns, these are the possibilities.

-   The problem is under constrained. Solve with symbols, make list of
    the independent variables that are going to be symbols in the
    answers and dependent variables that are going to equal something.
    Sometimes the entire problem is to be solved with symbols and there
    are no numbers.
-   If the problem is out of a text book, then re-read the problem
    perhaps there are other facts that can be turned into equations.
-   Make assumptions. Make them very clearly and loudly .. NOW at the
    beginning of the problem.

### Terminal Equations

The terminal equations were covered earlier. Here are some additional
points:

-   If the current is not going into the + voltage side, then add a
    negative sign.
-   Write the differential form, not the integral form of the terminal
    relation.
-   There are no terminal relations for independent supplies, dependent
    supplies do have a terminal relation.
-   Don\'t try to solve the equations that include differentials right
    now just write them.

### Loop Equations

The principle of energy conservation implies that the sum of the
electrical potential differences (voltage) around any closed loop is
zero:

$$\sum_{k=1}^n V_k = 0$$

Go around the loop in the direction labeled with your finger. If your
finger enters the plus side first, the voltage (in the formula, not
perhaps in the solution) is positive. If your finger enters the negative
side first, the voltage is negative. There are two cases where the
voltage will be negative:

-   a voltage source arbitrarily ended up negative
-   a previous loop labeled the voltages first and it happened to be in
    the opposite direction

The current direction does not matter in the loop equations.

Write an equation for each loop.

The goal is not to guess the + or - voltage of the answer (a
technician\'s goal). The goal is to get the + or - in the equation to
correctly match the circuit. When finished, the last step is to look
through the answers and see if they make sense from an intuitive point
of view. That\'s it.

### Junction Equations

The principle of electric charge conservation implies that at any
\"junction\", the sum of the currents flowing into the note is zero.

$$\sum_{k=1}^n {I}_k = 0$$

*n* is the total number of branches with currents attached to the
\"junction.\"

If the current is flowing into the node, make it positive. If current is
flowing out of the node, make it negative.

Check series sections for two different current symbols. Current should
be the same in a series section.

The goal of the + and - signs is to capture the circuit design in the
equations. This has nothing to do with whether the ultimate current is
flowing in or out of the node. Do not try to guess current direction
either.

### What\'s Next

Nothing.

Kirchhoff\'s analysis falls apart because the number of equations
increases dramatically as a circuit becomes more complex. This is not a
problem for computers, but it is a problem for engineers and techs. The
rest of this course is full of math, simplifications, quirks, tricks,
tips, and shortcuts. All have limitations. All fail at some point. The
goal is to go through them, observe conditions when they succeed and
fail, and then add them to our design tool belt and our intuition.


# Circuit Theory/Simultaneous Equations

### Solving Equations

The goal of this section is to illustrate how complicated circuits can
get very quickly. This sets up the need for learning circuit
simplification techniques described later. The goal here is to use math
tools to design circuits.

There are several issues that need to be reviewed while solving
simultaneous linear equations:

-   Numeric or Symbolic answers
-   Algebra
-   Symbolic Computation
-   Numeric Solutions (Linear Algebra)

After quick reviews, the goal is to start designing/reverse engineering
circuits.

#### Numerical or Symbolic

You are going to need to solve linear simultaneous equations two ways in
this course:

-   result in numerical answers when perfectly constrained
-   result in variable symbol answers when under constrained

You are going to need to recognize the difference between the two.

#### Algebra

Algebra can be used for simple circuits. Even more complicated circuits
can be designed or reversed engineered using algebra, but not in a way
that others can check. The solutions become very complicated. Better,
more standard, techniques exist. You need to learn when to switch to
these more respectable techniques.

#### Symbolic Computation

In its research context, \"symbolic
computation\" has many goals, of
which two concern us: **numeric computing** solutions that approximate
with floating point numbers, and **symbolic computing** that focuses on
exact solutions using symbols and formulas. You are going to need both
to succeed. There are lots of packages that try to do both.

This text focuses on MathWork\'s MuPAD and
MatLab plus
Mathematica\'s Wolfram
Alpha. MatLab has a huge engineering
community growing it\'s toolboxes including the symbolic toolbox MuPAD.
Mathematica represents how people think, learn and communicate math.
Mathematica is more attractive to scientists.

You need to invest time in three types of solutions:

-   solutions using variable names
-   symbolic solutions using fractions with whole numbers and constants
    like $\pi$
-   numeric approximations

All you have ever done with a calculator are numeric approximations. All
you have ever done in algebra is form solutions with variable names. The
middle solution is called a \"symbolic solution\" where answers are
expressed in whole number ratios instead of decimal places.

#### Numeric Solution

Symbolic solutions (MathWorks MuPAD or Mathematica) require a lot more
typing. They stress computers more and are more likely to fail. But they
are a lot better at exploring theories, pointing out concepts, and
creating transparency. This
transparency enables conversations, corrections, and growth of
intuition.

Numeric solutions hide details, make consideration of design
alternatives harder, and make troubleshooting/harmonizing/checking
engineering work more difficult. But they are a lot faster both setting
up, executing and in exploring alternatives
interatively. This is what MathWorks MatLab
focuses on.

Numeric solutions require organizing all solutions into matrices before
going to the computer. Linear Algebra is a
course typically taken after calculus that explains how to do this. But
lots of engineering classes require using some of Linear Algebra\'s
concepts before you take the course. The same is true here. Read the
examples below and you will get the hang of it.

### Solution Summary

From the previous two pages, the solution can be outlined as follows:

1.  Label currents and
    voltages
2.  Identify loops, add + - to each
    voltage
3.  Identify Junctions, put arrow heads on
    currents
4.  Count knowns and
    unknowns
5.  Write terminal
    equations
6.  Write loop
    equations
7.  Write junction
    equations
8.  Solve equations:
    1.  Algebra
    2.  Differential Equations
    3.  Symbolic Solution
    4.  Numeric Solution
9.  Simulate (circuitlab
    everycircuit
    icircuit falstad
    animations
    ecstudio)
10. Build Intuition/Check/Compare


# Circuit Theory/Sinusoidal Sources

## Steady State

\"Steady State\" means that we are not dealing with turning on or
turning off circuits in this section. We are assuming that the circuit
was turned on a very long time ago and it is behaving in a pattern. We
are computing what the pattern will look like. The \"complex frequency\"
section models turning on and off a circuit with an exponential.

## Sinusoidal Forcing Functions

Let us consider a general AC forcing function:

$$v(t) = M\sin(\omega t + \phi)$$

In this equation, the term M is called the \"Magnitude\", and it acts
like a scaling factor that allows the peaks of the sinusoid to be higher
or lower than +/- 1. The term ω is what is known as the \"Radial
Frequency\". The term φ is an offset parameter known as the \"Phase\".

Sinusoidal sources can be current sources, but most often they are
voltage sources.

## Other Terms

There are a few other terms that are going to be used in many of the
following sections, so we will introduce them here:

Period : The period of a sinusoidal function is the amount of time, in seconds, that the sinusoid takes to make a complete wave. The period of a sinusoid is always denoted with a capital T. This is not to be confused with a lower-case t, which is used as the independent variable for time.

```{=html}
<!-- -->
```

Frequency : Frequency is the reciprocal of the period, and is the number of times, per second, that the sinusoid completes an entire cycle. Frequency is measured in Hertz (Hz). The relationship between frequency and the Period is as follows:

$$f = \frac{1}{T}$$

:   Where f is the variable most commonly used to express the frequency.

```{=html}
<!-- -->
```

Radian Frequency : Radian frequency is the value of the frequency expressed in terms of Radians Per Second, instead of Hertz. Radian Frequency is denoted with the variable $\omega$. The relationship between the Frequency, and the Radian Frequency is as follows:

$$\omega = 2 \pi f$$

Phase : The phase is a quantity, expressed in radians, of the time shift of a sinusoid. A sinusoid phase-shifted $\phi = +2 \pi$ is moved forward by 1 whole period, and looks exactly the same. An important fact to remember is this:

$$\sin (\frac{\pi}{2}-t) = \cos (t)$$ or
$\sin (t) = \cos (t - \frac{\pi}{2})$

Phase is often expressed with many different variables, including
$\phi, \psi, \theta, \gamma$ etc\... This wikibook will try to stick
with the symbol $\phi$, to prevent confusion.

## Lead and Lag

A circuit element may have both a voltage across its terminals and a
current flowing through it. If one of the two (current or voltage) is a
sinusoid, then the other must also be a sinusoid (remember, voltage is
the derivative of the current, and the derivative of a sinusoid is
always a sinusoid). However, the sinusoids of the voltage and the
current may differ by quantities of magnitude and phase.

If the current has a lower phase angle than the voltage the current is
said to **lag** the voltage. If the current has a higher phase angle
then the voltage, it is said to **lead** the voltage. Many circuits can
be classified and examined using lag and lead ideas.

## Sinusoidal Response

Reactive components (capacitors and inductors) are going to take energy
out of a circuit like a resistor and then pump some of it back into the
circuit like a source. The result is initially a mess. But after a while
(5 time constants), the circuit starts behaving in a pattern. The
capacitors and inductors get in a rhythm that reflects the driving
sources. If the source is sinusoidal, the currents and voltages will be
sinusoidal. This is called the \"particular\" or \"steady state\"
response. In general:

$$A_{in} \cos(\omega_{in} t + \phi_{in}) \to A_{out} \cos(\omega_{out} t + \phi_{out})$$

What happens initially, what happens if the capacitor is initially
charged, what happens if sources are switched in and out of a circuit is
that there is an energy imbalance. A voltage or current source might be
charged by the initial energy in a capacitor. The derivative of the
voltage across an Inductor might instantaneously switch polarity. Lots
of things are happening. We are going to save this for later. Here we
deal with the steady state or \"particular\" response first.

## Sinusoidal Conventions

For the purposes of this book we will generally use cosine functions, as
opposed to sine functions. If we absolutely need to use a sine, we can
remember the following trigonometric identity:

$$\cos(\omega t) = \sin(\pi/2 -\omega t)$$

We can express all sine functions as cosine functions. This way, we
don\'t have to compare apples to oranges per se. This is simply a
convention that this wikibook chooses to use to keep things simple. We
could easily choose to use all sin( ) functions, but further down the
road it is often more convenient to use cosine functions instead by
default.

## Sinusoidal Sources

There are two primary sinusoidal sources: wall outlets and
oscillators. Oscillators are
typically crystals that electrically vibrate and are found in devices
that communicate or display video such as TV\'s, computers, cell phones,
radios. An electrical engineer or tech\'s working area will typically
include a \"function generator\"
which can produce oscillations at many frequencies and in shapes that
are not just sinusoidal.

RMS or Root mean square is a measure
of amplitude that compares with DC magnitude in terms of power, strength
of motor, brightness of light, etc. The trouble is that there are
several types of AC amplitude:

-   peak
-   peak to peak
-   average
-   RMS

Wall outlets are called AC or
alternating current. Wall outlets are sinusoidal voltage sources that
range from 100 RMS volts, 50 Hz to 240 RMS volts 60 Hz worldwide. RMS,
rather than peak (which makes more sense mathematically), is used to
describe magnitude for several reasons:

-   historical reasons related to the competition between Edison (DC
    power) and Tesla (Sinusoidal or AC power)
-   effort to compare/relate AC (wall outlets) to DC (cars, batteries)
    .. 100 RMS volts is approximately 100 DC volts.
-   average sinusoidal is zero
-   meter movements (physical needles
    moving on measurement devices) were
    designed to measure both DC and RMS AC

RMS is a type of average:
$p_{\mathrm{rms}} = \sqrt {{1 \over {T_2-T_1}} {\int_{T_1}^{T_2} {[p(t)]}^2\, dt}}$

Electrical power delivery is
a complicated subject that will not be covered in this course. Here we
are trying to define terms, design devices that use the power and
understand clearly what comes out of wall outlets.


# Circuit Theory/Maximum Power Transfer

## Maximum Power Transfer

Often we would like to transfer the most power from a source to a load
placed across the terminals as possible. How can we determine the
optimum resistance of the load for this to occur?

Let us consider a source modelled by a Thévenin equivalent (a Norton
equivalent will lead to the same result, as the two are directly
equivalent), with a load resistance, *R~L~*. The source resistance is
*R~s~* and the open circuit voltage of the source is *v~s~*:

![](Maximum_Power_Transfer_Circuit.svg "Maximum_Power_Transfer_Circuit.svg")

The current in this circuit is found using Ohm\'s Law:

$$i=\frac{v_s}{R_s+R_L}$$

The voltage across the load resistor, *v~L~*, is found using the voltage
divider rule:

$$v_L=v_s \,\frac{R_L}{R_s + R_L}$$

We can now find the power dissipated in the load, *P~L~* as follows:

$$P_L=v_Li=\frac{R_L \, v^2_s}{\left(R_s+R_L\right)^2}$$

We can now rewrite this to get rid of the *R~L~* on the top:

$$P_L=\frac{v^2_s}{ \left(\frac{{R_s}}{\sqrt{R_L}}+\sqrt{R_L}\right)^2} =
\frac{v^2_s}{ R_s \left(\frac{\sqrt{R_s}}{\sqrt{R_L}}+\frac{\sqrt{R_L}}{\sqrt{R_s} }\right)^2}$$

Assuming the source resistance is not changeable, then we obtain maximum
power by minimising the bracketed part of the denominator in the above
equation. It is an elementary mathematical result that $x+x^{-1}$ is at
a minimum when *x=1*. In this case, it is equal to 2. Therefore, the
above expression is minimum under the following condition:

$$\frac{\sqrt{R_s}}{\sqrt{R_L}}=1$$

This leads to the condition that:

:

    :   {\|style=\" border: solid 2px #D6D6FF; padding: 1em;\"
        valign=\"top\"

\|align=\"left\"\|$R_L=R_s \,$ \|}

### Efficiency

The efficiency, *η* of the circuit is the proportion of all the energy
dissipated in the circuit that is dissipated in the load. We can
immediately see that at maximum power transfer to the load, the
efficiency is 0.5, as the source resistor has half the voltage across
it. We can also see that efficiency will increase as the load resistance
increases, even though the power transferred will fall.

The efficiency can be calculated using the following equation:

$$\eta=\frac{P_L}{P_L+P_s}$$ where *P~s~* is the power in the source
resistor. This can be found using a simple modification to the equation
for *P~L~*:

$$P_s=\frac{v^2_s}{ R_L \left(\frac{\sqrt{R_s}}{\sqrt{R_L}}+\frac{\sqrt{R_L}}{\sqrt{R_s} }\right)^2}$$

The graph below shows the power in the load (as a proportion of the
maximum power, *P~max~*) and the efficiency for values of *R~L~* between
0 and 5 times *R~s~*.

![](Maximum_Power_Transfer_Graph.svg "Maximum_Power_Transfer_Graph.svg")

It is important to note that under conditions of maximum power transfer
as much power is dissipated in the source as in the load. This is not a
desirable condition if, for example, the source is the electricity
supply system and the load is your electric heater. This would mean that
the electricity supply company would be wasting half the power it
generates. In this case, the generators, power lines, etc. are designed
to give the lowest source resistance possible, giving high efficiency.
The maximum power transfer condition is used in (usually high-frequency)
communications systems where the source resistance can not be made low,
the power levels are relatively low and it is paramount to get as much
signal power as possible to the receiving end of the system (the load).


# Circuit Theory/Power Factor

Power factor is defined as:

$$p_f = \cos(\phi_v - \phi_i)$$

Facts:

-   The power factor is ideally 1.
-   Power factors less than 0.9 cause a visit by your utility company.
-   Building wire codes are designed to maximize the power factor.
-   Circuits are purely resistive (no capacitors or inductors) when they
    have a power factor of 1.
-   Capacitors can cancel out inductors (and vice versa) to create
    purely resistive circuits.
-   The Math of this is easiest in the phasor domain.
-   Exceptions to this are where building up oscillations are the design
    objective \... such as the cavity in a microwave oven or designing a
    musical instrument.
-   The turbulence that the power factor measures can only be seen in
    the phasor domain.

Let\'s consider two circuits: !series RLC
circuit !parallel RLC
circuit

## Series Circuit

The voltage across the inductor and capacitor have to cancel each other
out. This means that the power supply doesn\'t see either. This means
that the inductor and capacitor are passing energy back and forth, but
the resistor and power supply can not see them. This means that

$$\mathbb{V}_L + \mathbb{V}_C = 0$$

$$\mathbb{V}_L = - \mathbb{V}_C$$ The current is going to be the same:

$$\mathbb{I}$$ From the terminal relations:

$$\mathbb{V}_L = jwL\mathbb{I}$$

$$\mathbb{I} = jwC\mathbb{V}_C$$ Solving for $\mathbb{V}_C$:

$$\mathbb{V}_C = \frac{\mathbb{I}}{jwC}$$ Substituting into the voltage
equation:

$$jwL\mathbb{I} = - \frac{\mathbb{I}}{jwC}$$ Now solving for C:

$$C = \frac{1}{Lw^2}$$

## Parallel Circuit

The current through the inductor and capacitor have to cancel each other
out. This means that the power supply doesn\'t see either. This means
that the inductor and capacitor are passing energy back and forth, but
the resistor and power supply can not see them. This means that

$$\mathbb{I}_L + \mathbb{I}_C = 0$$

$$\mathbb{I}_L = - \mathbb{I}_C$$ The voltage is going to be the same:

$$\mathbb{V}$$ From the terminal relations:

$$\mathbb{V} = jwL\mathbb{I}_L$$

$$\mathbb{I}_C = jwC\mathbb{V}$$ Solving for $\mathbb{I}_L$:

$$\mathbb{I}_L = \frac{\mathbb{V}}{jwL}$$ Substituting into the current
equation:

$$jwC\mathbb{V} = - \frac{\mathbb{V}}{jwL}$$ Now solving for C:

$$C = \frac{1}{Lw^2}$$

So either way the formula for the capacitor to cancel out the inductor
is the same. This is strange because in the series circuit the L&C have
to combine to be a short to be invisible, and in the parallel circuit
they have to combine to be an open.

Obviously, there is never going to be a perfect match. If there were a
perfect match with ideal devices and a butterfly flapped its wings, the
circuit could blow up. But that is another story for later in this
course \...

## Dependence on Frequency

Eliminating the effects of inductance with capacitance is dependent upon
frequency. If the frequency deviates, then another imbalance occurs. In
power distribution systems, the 60 Hz or 50 Hz frequency doesn\'t
change. But in modems, radios and cable TV boxes, the frequency does
change \... when someone speaks, when data moves through a cable, when
changing channels. One of the objectives of this course is to understand
how to design/plan for these changes.


# Circuit Theory/Complex Frequency

### Complex Frequency Why?

Phasor concepts can be extended to cover the turning off and on of
circuits using exponentials. For example:

$$V_s(t)= (1-e^{-\frac{t}{\tau}})\cdot f(t)$$ turn on

$$V_s(t)= ( e^{-\frac{t}{\tau}})\cdot f(t)$$ turn off The value of
$\tau$ (or the time constant) determines how quickly the circuit turns
on and off. Adding some constants can determine when the circuit turns
on and off.

Why not Laplace transforms? Laplace transforms can model infinite slopes
for turning off and on circuits. We are not going to do that in this
course. The real world can be modeled with $\tau$. Laplace transforms
are simple, beautiful and truly amazing in that they can handle
infinities and infinitesimals. Scientists and mathematicians are always
interested in tools that help them work with the road blocks of
infinities and infinitesimals. So far this course has been dealing with
ideal inductors, resistors, wires, sources, etc. And if we were to deal
with ideal turning off and on, we could not use phasors. We would have
to use Laplace. So at this point an exception has been made.

Or one could just consider \"Complex Frequencies\" as exploring a more
complex function in a way similar to phasors.

### Complex Frequency Derivation

Before $V(t)=V_m cos(\omega t + \phi)$ modeled steady state circuits
(never turned off and on).

Now let\'s consider $V(t) = V_m e^{\sigma t} cos(\omega t + \phi)$.
Sigma or $\sigma$ is usually negative, otherwise the circuit will
explode. Splitting the charging problem into two problems and adding the
results in the end is called \"superposition\" which usually works. So
we can reduce both situations down to exploring the phasor math of this
equation.

Substituting
$cos(\omega t + \phi) = \operatorname{Re}(e^{j(\omega t + \phi)})$ from
Euler\'s equation, we can start a derivation that shows almost nothing
changes in the phasor domain!

  expression                                                           notes
  -------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------
  $V(t) = \operatorname{Re}(V_m e^{\sigma t}e^{j(\omega t + \phi}))$   substitution
  $V(t) = \operatorname{Re}(V_m e^{j\phi} e^{(\sigma+j\omega)t})$      reorganizing the exponents
  $s=\sigma + j\omega$                                                 defining the complex frequency $s$
  $V(t) = \operatorname{Re}(V_m e^{j\phi} e^{st})$                     after substitution there is no difference
  $\mathbb{V}=V_m e^{j\phi}$                                           Defining the phasor \... nothing different .. $s$ instead of $j\omega$ from derivatives and integrals
  $V(t) = \operatorname{Re}(\mathbb{V} e^{st})$                        Can we assume $\omega$ (angular frequency) and $s$ (complex frequency) can be treated the same? Yes \... almost.

### time domain to complex frequency domain

The above process shows that converting v(t) and i(t) to phasors is the
exact same process. No need to think about $s$ at all.

  Terminal Equation      Phasor Domain                  Complex Frequency domain
  ---------------------- ------------------------------ -----------------------------
  $V = RI$               $\mathbb{V} = R\mathbb{I}$     $\mathbb{V} = R\mathbb{I}$
  $V = L\frac{d}{dt}I$   $\mathbb{V} = jwL\mathbb{I}$   $\mathbb{V} = sL\mathbb{I}$
  $I = C\frac{d}{dt}V$   $\mathbb{I} = jwC\mathbb{V}$   $\mathbb{I} = sC\mathbb{V}$

What is interesting is that the complex frequency operators are the same
as the Laplace transform
operators.
This is why they both use the term \"complex frequency\" to describe s.

What makes the Laplace transform operators so complicated is the
different way the transform the functions!

However, as we will see later (in transfer functions), when turning a
circuit into a black box, hooking a driving source up to it and then
describing the output, the driving function transform doesn\'t matter.
Just the derivative and integral operator transforms matter.

### math in the Complex Frequency Domain

Math in the Complex Frequency Domain, with symbols, does not involve
keeping track of the $\sqrt{-1}$. The symbol $s$ contains a complex
number. The math programs all work internally in rectangular form.
Substituting numerically for $s$ with a complex number is simple:

$$s = \sigma + j\omega$$.

### complex frequency back to time domain

The unknown function(s) is/are going to look something like this:
$V(t) = \operatorname{Re}(\mathbb{V} e^{st})$ or
$I(t) = \operatorname{Re}(\mathbb{I} e^{st})$. Substituting for s in the
time domain means working with exponents a little. Getting back into the
time domain will not be as simple as putting the unknown function in
polar form.

### Summary

Find $s$ during the creation of phasors instead of $\omega$. Substitue
$s$ for $j\omega$ when replacing the derivative in the terminal
relations. Use $s=\sigma + j\omega$ when moving back into the time
domain.

The goal in the examples is to explore the similarities and differences
of the symbol $s$ as used in Complex Frequency analysis and in the
Laplace transform. The Laplace transform also uses the symbol $s$ and
also calls it the \"complex frequency.\" But are they the same thing?
No. They both use the same complex frequency techniques for transforming
the differential and integral operators. But they use different
techniques for transforming the functions. Complex frequency transforms
functions like phasors and operators like Laplace transforms.


# Circuit Theory/Impedance

The impedance concept has to be
formally introduced in order to solve node and mesh problems.

!the impedance symbol is .. a
box

## Symbols & Definition

Impedance is a concept within the phasor domain / complex frequency
domain.

Impedance is not a phasor although it is a complex number.

Impedance = Resistance + Reactance:

$$Z = R + X$$

:   Impedance = $Z$
:   Resistance = $R$
:   Reactance = $X$

## Reactance

Reactance comes from either
inductors or capacitors:

$$X_L$$

$$X_C$$

Reactance comes from solving the terminal relations in the phasor
domain/complex frequency domain as ratios of V/I:

$$\frac{V}{I} = R$$

$$\frac{V}{I} = X_L = j\omega L$$ or $X_L = sL$

$$\frac{V}{I} = X_C = \frac{1}{j\omega C}$$ or $X_C = \frac{1}{sC}$

Because of Euler\'s equation and the assumption of exponential or
sinusoidal driving functions, the operator $\frac{d}{dt}$ can be
decoupled from the voltage and current and re-attached to the inductance
or capacitance. At this point the inductive reactance and the capacitive
reactance are conceptually imaginary resistance (not a phasor).

Reactance is measured in ohms like resistance.

## Characteristics

Impedance has magnitude and angle like a phasor and is measured in ohms.

Impedance only exists in the phasor or complex frequency domain.

Impedance\'s angle indicates whether the inductor or capacitor is
dominating. A positive angle means that inductive reactance is
dominating. A negative angle means that capacitive reactance is
dominating. An angle of zero means that the impedance is purely
resistive.

Impedance has no meaning in the time domain.


# Circuit Theory/Series Resistance

## Series Resistance

Two or more resistor can be connected in series to increase the total
resistance . The Total Resistance is equal to the sum of all the
resistor\'s resistance . The total resistance In Series connected
circuit Current and voltage will be reduced

:   ![](Resistors_in_Series.svg "fig:Resistors_in_Series.svg"){width="200"}
:   $R_{tot}=R_1+R_2+R_3+...+R_n \,$

## Series Impedance

!used to show how impedance add\'s in
series

A branch is defined as any group of resistors, capacitors and inductors
that can be circled with only two wires crossing the circle boundary.

A branch connects two, non-trivial nodes or junctions.

Within a branch the components are said to be \"in series.\"

Consider a branch containing a Resistor, Capacitor and Inductor.

Say the driving function or source is

$$V_s = 10*cos(22400t+30^\circ)$$

$$V_s = 10*e^{-5000t}cos(22400t+30^\circ)$$

There is just one current, $I$.

## Symbolic Derivation

!the impedance symbol is .. a
box The
terminal equations are:

$$\mathbb{V}_r = \mathbb{I}*R$$

$$\mathbb{V}_L = \mathbb{I}*j\omega L$$ or
$\mathbb{V}_L = \mathbb{I}*sL$

$$\mathbb{I} = \mathbb{V}_c *j\omega C$$ or
$\mathbb{I} = \mathbb{V}_c *sC$ There are no junction equations and the
loop equation is:

$$\mathbb{V}_r + \mathbb{V}_L + \mathbb{V}_c - \mathbb{V}_s = 0$$
Solving the terminal equations for voltage, substituting and then
dividing by $\mathbb{I}$ yields:

$$\frac{\mathbb{V}_s}{\mathbb{I}} = R + j\omega L + \frac{1}{j\omega C}$$

$$\frac{\mathbb{V}_s}{\mathbb{I}} = R + sL + \frac{1}{sC}$$ In terms of
impedance, if:

$$Z = R + j\omega L + \frac{1}{j\omega C}$$

$$Z = R + sL + \frac{1}{sC}$$ Then:

$$\frac{\mathbb{V}_s}{\mathbb{I}} = Z$$

In general, impedances add in series like resistors do in the time
domain:

$$Z = \sum R_i + \sum j\omega L_i + \sum\frac{1}{j\omega C_i}$$

$$Z = \sum R_i + \sum sL_i + \sum\frac{1}{sC_i}$$

!matlab screen shot of numeric calculation ..
/m-file/

## Numeric Example

In rectangular form:

$$Z = 100 + .15714j$$

$$Z = 80.508 + 2.2759j$$

In polar form (remember impedance is not a phasor, it is a concept in
the phasor or complex frequency domain):

$$Z = 100.0001\angle 0.0016 (0.09^\circ)$$

$$Z = 80.5402\angle  0.0283 (1.6193^\circ)$$

## Notes

-   Calculations like this are only necessary when trying to find out
    what is going on in one little part of the circuit \... and
    Kirchhoff would take too long. This was true in the past, but given
    the modern capabilities of matLab and mupad, the importance of the
    series concept may diminish.

```{=html}
<!-- -->
```
-   It appears that the exponential term decreases the overall magnitude
    and increases the reactance \... increases in the inductive
    direction with the exponential term.

```{=html}
<!-- -->
```
-   The V/I ratio sets up/prepares for the transfer function discussion
    later.


# Circuit Theory/Parallel Resistance

## Parallel Resistance

Resistors in parallel share the same voltage. They split the current up.
Giving the current multiple paths to follow means that the overall
resistance decreases.

!A diagram of several resistors, side by side, both leads of each
connected to the same
wires.

$$R_\mathrm{total} =\frac{1}{ \frac{1}{R_1} + \frac{1}{R_2} + \cdots + \frac{1}{R_n}} = \frac{1}{\sum\frac{1}{R_i}}$$

The above equation is often called the \"one over \-- one over\"
equation.

## Parallel Impedance

!used to show how impedance add\'s in
parallel

A group of parallel branches split up the current, but share the same
voltage. The parallel branches connect the same two nodes.

The impedance of parallel branches can be combined into one impedance.

Consider these parallel branches: one with a resistor, another with a
capacitor and a third with an inductor.

Now drive them with a voltage source:

$$V_s = 10*cos(22400t+30^\circ)$$

$$V_s = 10*e^{-5000t}cos(22400t+30^\circ)$$

There is just one current, $V$.

## symbolic derivation

!the impedance symbol is .. a
box !Parallel
Impedance calculation with matlab
..m-file
The terminal equations are:

$$\mathbb{V}_s = \mathbb{I}_r*R$$

$$\mathbb{V}_s = \mathbb{I}_L*j\omega L$$ or
$\mathbb{V}_s = \mathbb{I}_L*sL$

$$\mathbb{I}_c = \mathbb{V}_s *j\omega C$$ or
$\mathbb{I}_c = \mathbb{V}_s *sC$ There are no loop equations and the
junction equation is:

$$\mathbb{I}_r + \mathbb{I}_L + \mathbb{I}_c - \mathbb{I}_s = 0$$
Solving the terminal equation for currents, substituting and dividing
both sides by $\mathbb{V}_s$ yields:

$$\frac{\mathbb{I}_s}{\mathbb{V}_s} = \frac{1}{R} + \frac{1}{j\omega L} + j\omega C$$

$$\frac{\mathbb{I}_s}{\mathbb{V}_s} = \frac{1}{R} + \frac{1}{sL} + sC$$
In terms of impedance, if:

$$\frac{1}{Z} = \frac{1}{R} + \frac{1}{j\omega L} + j\omega C$$

$$\frac{1}{Z} = \frac{1}{R} + \frac{1}{sL} + sC$$ Then:

$$\frac{\mathbb{I}_s}{\mathbb{V}_s} = \frac{1}{Z}$$

In general, impedances add in series like resistors do in the time
domain:

$$\frac{1}{Z} = \sum\frac{1}{R_i} + \sum\frac{1}{j\omega L_i} + \sum j\omega C_i$$

$$\frac{1}{Z} = \sum\frac{1}{R_i} + \sum\frac{1}{sL_i} + \sum sC_i$$ or

$$Z = \frac{1}{\sum\frac{1}{R_i} + \sum\frac{1}{j\omega L_i} + \sum j\omega C_i}$$

$$Z = \frac{1}{\sum\frac{1}{R_i} + \sum\frac{1}{sL_i} + \sum sC_i}$$

## numeric example

$$Z = 99.9938 - 0.7857i = 99.9969\angle -0.0079 (-0.4502^\circ)$$

$$Z = 186.85 -837.07i = 857.6701\angle -1.3512 (-77.4170^\circ)$$

So the exact same components hooked in series are dominated by the
inductor (large reactance of the inductor overshadows the smaller
reactance of the capacitor), but when the same components are hooked in
parallel, the small er capacitive reactance dominates.

## notes

What is the point of all this? The goal is to start with simple
circuits, explore them with words and symbols, find the patterns and
generalize, establish and name concepts and then wait for their
application. What are we waiting for? Selecting channels on a
TV/Radio/Wifi, ZigBee, RFID, Cellphones, Blue
Tooth and sending data over these channels as well as to hard drives and
SD cards, monitors and hubs, designing antennas, \....


# Circuit Theory/Node Analysis

Node analysis is done in the phasor domain.

The Node Analysis method reduces the number of equations and unknowns
one is finding in a circuit.

Kirchhoff\'s method finds all currents and voltages. Node Analysis only
finds the voltages at nodes (junctions).

Node analysis starts with Kirchhoff junction equations:

$$\sum_{k=1}^n {I}_k = 0$$ and solves terminal equations so that current
is a function of voltage, and then substitutes into the junction current
equation:

$$i = \frac{\Delta V}{R}$$

$$i = C * j\omega \Delta V = sC \Delta V$$

$$i = \frac{\Delta V}{j\omega L} = \frac{\Delta V}{sL}$$

What is $\Delta V$? It is the voltage with respect to ground of the node
on either side of the device being considered.

$$\Delta V = V_{nodeA} - V_{nodeB}$$ Where current is following from
node_A to node_B.

At first glance this may seem trivial, but there are subtle differences
exposed when doing the problems:

-   Node voltages are relative to ground. They are not Kirchhoff\'s
    drops across individual devices.
-   Assume all currents leave nodes.
-   Terminal relation equations are more complicated.
-   Has to be done in the phasor domain so impedances between nodes can
    be computed.
-   Can have too few equations requiring finding \"super node\"
    equations.
-   Some problems can not be solved. Recognizing these is not trivial.

## Examples

### Basic case

!Basic example circuit with one unknown voltage,
V~1~.{width="280"}

The only unknown voltage in this circuit is V~1~. There are three
connections to this node and consequently three currents to consider.
The direction of the currents in calculations is chosen to be away from
the node.

1.  Current through resistor R~1~: (V~1~ - V~S~) / R~1~
2.  Current through resistor R~2~: V~1~ / R~2~
3.  Current through current source I~S~: -I~S~

\
With Kirchhoff\'s current law, we get:

$\frac{V_1 - V_S}{R_1} + \frac{V_1}{R_2} - I_S = 0$\
This equation can be solved in respect to V~1~:

$V_1 = \frac{\left( \frac{V_S}{R1} + I_S \right)}{\left( \frac{1}{R_1} + \frac{1}{R_2} \right)}$\
Finally, the unknown voltage can be solved by substituting numerical
values for the symbols. Any unknown currents are easy to calculate after
all the voltages in the circuit are known.

$V_1 = \frac{\left( \frac{5\text{ V}}{100\,\Omega} + 20\text{ mA} \right)}{\left( \frac{1}{100\,\Omega} + \frac{1}{200\,\Omega} \right)} \approx 4.667\text{ V}$

The fact that $V_1 < V_s$ and implies that current flows in the opposite
direction through R~1~ reflects the fact that assuming that current
flows out of a node just helps us write equations that capture the
circuit topology in order to write logically consistent equations. They
are in no way a guess at the final current direction.

### Another Example

Given the Circuit below, find the voltages at all nodes.

center\|framed\|example circuit for nodal analysis
example.

-   node 0: $V_0 = 0V\,$ (defined as ground node)\
-   node 1: $V_1 = 9V\,$ (free node voltage)\
-   node 2:
    $\frac{V_1 - V_2}{1k} = \frac{V_2 - V_0}{3k} + \frac{V_2 - V_3}{2k}$\
    \
-   node 3: $\frac{V_2 - V_3}{2k} = \frac{V_3 - V_0}{2k}$\

which results in the following system of linear equations:

$$\left\{\begin{matrix} +11 V_2 & -3 V_3 & = & 54 \\ +1 V_2 & -2 V_3 & = & 0\end{matrix}\right.$$

Therefore, the solution is:

$$\left\{\begin{matrix} V_0 =0.00V \\ V_1 =9.00V \\ V_2 =5.68V \\ V_3 =2.84V\end{matrix}\right.$$\

### Supernodes

!In this circuit, V~A~ is between two unknown voltages, and is
therefore a
supernode.{width="182"}
In this circuit, we initially have two unknown voltages, V~1~ and V~2~.
The voltage at V~3~ is already known to be V~B~ because the other
terminal of the voltage source is at ground potential.

The current going through voltage source V~A~ cannot be directly
calculated. Therefore we can not write the current equations for either
V~1~ or V~2~. However, we know that the same current leaving node V~2~
must enter node V~1~. Even though the nodes can not be individually
solved, we know that the combined current of these two nodes is zero.
This combining of the two nodes is called the supernode technique, and
it requires one additional equation: V~1~ = V~2~ + V~A~.

The complete set of equations for this circuit is:

$\begin{cases}
\frac{V_1 - V_\text{B}}{R_1} + \frac{V_2 - V_\text{B}}{R_2} + \frac{V_2}{R_3} = 0\\
V_1 = V_2 + V_\text{A}\\
\end{cases}$

By substituting V~1~ to the first equation and solving in respect to V2,
we get:

$V_2 = \frac{(R_1 + R_2) R_3 V_\text{B} - R_2 R_3 V_\text{A}}{(R_1 + R_2) R_3 + R_1 R_2}$