# Circuit Theory/Analysis Methods
## Analysis Methods

When circuits get large and complicated, it is useful to have various methods for simplifying and analyzing the circuit. There is no perfect formula for solving a circuit. Depending on the type of circuit, there are different methods that can be employed to solve the circuit. Some methods might not work, and some methods may be very difficult in terms of long math problems. Two of the most important methods for solving circuits are Nodal Analysis, and Mesh Current Analysis. These will be explained below.

## Superposition

One of the most important principals in the field of circuit analysis is the principal of superposition. It is valid only in linear circuits.
The superposition principle states that the total effect of multiple contributing sources on a linear circuit is equal to the sum of the individual effects of the sources, taken one at a time.
What does this mean? In plain English, it means that if we have a circuit with multiple sources, we can "turn off" all but one source at a time, and then investigate the circuit with only one source active at a time. We do this with every source, in turn, and then add together the effects of each source to get the total effect. Before we put this principle to use, we must be aware of the underlying mathematics.

### Necessary Conditions

Superposition can only be applied to linear circuits; that is, all of a circuit's sources hold a linear relationship with the circuit's responses. Using only a few algebraic rules, we can build a mathematical understanding of superposition. If f is taken to be the response, and a and b are constant, then:
    $f(ax_{1}+bx_{2})=f(ax_{1})+f(bx_{2})\,$
In terms of a circuit, it clearly explains the concept of superposition; each input can be considered individually and then summed to obtain the output. With just a few more algebraic properties, we can see that superposition cannot be applied to non-linear circuits. In this example, the response y is equal to the square of the input x, i.e. y=x$^2$. If a and b are constant, then:
    $y=(ax_{1}+bx_{2})^{2}\neq (ax_{1})^{2}+(bx_{2})^{2}=y_{1}+y_{2}\,$
Note that this is only one of an infinite number of counter-examples...

### Step by Step

Using superposition to find a given output can be broken down into four steps:
* Isolate a source - Select a source, and set all of the remaining sources to zero. The consequences of "turning off" these sources are explained in Open and Closed Circuits. In summary, turning off a voltage source results in a short circuit, and turning off a current source results in an open circuit. (Reasoning - no current can flow through a open circuit and there can be no voltage drop across a short circuit.)
* Find the output from the isolated source - Once a source has been isolated, the response from the source in question can be found using any of the techniques we've learned thus far.
* Repeat steps 1 and 2 for each source - Continue to choose a source, set the remaining sources to zero, and find the response. Repeat this procedure until every source has been accounted for.
* Sum the Outputs - Once the output due to each source has been found, add them together to find the total response.

## Impulse Response

An impulse response of a circuit can be used to determine the output of the circuit:
The output y is the convolution h * x of the input x and the impulse response:
[Convolution]
    $y(t)=(h*x)(t)=\int _{-\infty }^{+\infty }h(t-s)x(s)ds$.
If the input, x(t), was an impulse ($\delta (t)$), the output y(t) would be equal to h(t).
By knowing the impulse response of a circuit, any source can be plugged-in to the circuit, and the output can be calculated by convolution.

## Convolution

The convolution operation is a very difficult, involved operation that combines two equations into a single resulting equation. Convolution is defined in terms of a definite integral, and as such, solving convolution equations will require knowledge of integral calculus. This wikibook will not require a prior knowledge of integral calculus, and therefore will not go into more depth on this subject then a simple definition, and some light explanation.

### Definition

The convolution a * b of two functions a and b is defined as:
    $(a*b)(t)=\int _{-\infty }^{\infty }a(\tau )b(t-\tau )d\tau$
The asterisk operator is used to denote convolution. Many computer systems, and people who frequently write mathematics on a computer will often use an asterisk to denote simple multiplication (the asterisk is the multiplication operator in many programming languages), however an important distinction must be made here: The asterisk operator means convolution.

### Properties

Convolution is commutative, in the sense that $a*b=b*a$. Convolution is also distributive over addition, i.e. $a*(b+c)=a*b+a*c$, and associative, i.e. $a*(b*c)=(a*b)*c$.

### Systems, and convolution

Let us say that we have the following block-diagram system:
* x(t) = system input
* h(t) = impulse response
* y(t) = system output
Where x(t) is the input to the circuit, h(t) is the circuit's impulse response, and y(t) is the output. Here, we can find the output by convoluting the impulse response with the input to the circuit. Hence we see that the impulse response of a circuit is not just the ratio of the output over the input. In the frequency domain however, component in the output with frequency ω is the product of the input component with the same frequency and the transition function at that frequency. The moral of the story is this: the output to a circuit is the input convolved with the impulse response.