One of the most commonly used test functions for a circuit or system is the sine (or cosine) wave. This is not because sine waves are a particularly common signal. They are in fact quite rare  the transmission of electricity (a 60 Hz sine wave in the U.S., 50 Hz in much of the rest of the world) is one example. The reason sine waves are important is complex and involve a branch of Mathematics called Fourier Theory. Briefly put: any signal going into a circuit can be represented by a sum of sinusoidal waves of varying frequency and amplitude (often an infinite sum).
This is why sine waves are important. Not because they are common, but because we can represent arbitrarily complex functions using only these very simple function.
Given that sinusoidal waves are important, how can we analyze the response of a circuit or system to sinusoidal inputs (after all transients have died out  the socalled sinusoidal steady state)? There are many ways to do this, depending on your mathematical sophistication. Let's use a fairly basic explanation that uses phasors. If you are unfamiliar with phasors, a brief introduction is here. A technique using Laplace Transforms is given here.
For a system of the type we are studying (linear constant coefficient) if the input to a system is sinusoidal at a particular frequency, then the output of the system is also a sinusoid at the same frequency, but typically with a different amplitude or phase. Put another way, if the input to a system (described by the transfer function H(s)) is A·cos(ω·t+φ) then the output is M·A·cos(ω·t+φ+θ). This is likewise true for sine, since it simply a cosine with φ=π2 radians (or 90°). This is shown below.
In this diagram the magnitude of the sinusoid has changed by a factor of M (which we will take to be a positive real number) and the phase has changed by a factor of θ (a real number, not necessarily positive). It is our task to find the value of M and θ for a particular system, H(s), at a particular frequency, ω. We call M the magnitude of the system (or transfer function) at ω, and we call θ the phase of the system at that frequency.
Using complex impedances it is possible to find the transfer function of a circuit. For example, the circuit below is described by the transfer function, H(s), where s= jω.
Circuit  Transfer Function 


\[H(s) = \frac{V_{out}\left( s \right)}{V_{in}\left( s \right)} = \frac{1}{1 + sRC}\] 
Consider the case where R=2MΩ and C=1μF. In that case:
\[H\left( s \right) = \frac{1}{1 + 2s}\quad \quad \quad H\left( {j\omega } \right) = \frac{1}{{1 + j2\omega }}\]
Generally we know the input V_{in} and want to find the output V_{out}. We can do this by simple multiplication
\[V_{out} \left( {j\omega } \right) = V_{in}\left( {j\omega } \right) \cdot H(j\omega ) = V_{in}\left( {j\omega } \right) \cdot \frac{1}{1 + j2\omega }\]
If we have a phasor representation for the input and the transfer function, the multiplication is simple (multiply magnitudes and add phases). Finding the output becomes easy. Try it out.
Use the radio buttons to choose a transfer function, and the sliders to choose the frequency, amplitude and phase of the input (you can also set frequency by clicking and dragging in either of the top two graphs.)
The paragraph below the sliders goes through the calculation of the numerical value of the transfer function at the chosen frequency, and gives H(jω) in terms of magnitude and phase. Note that these are also shown on the top two graphs by a dot. To find the magnitude of the output, simply multiply the magnitude of the input (A) by the magnitude of the transfer function (M). The phase of the output is sum of the input phase (φ) and the phase of the transfer function (θ).
The bottom graph shows input, V_{in}(t) in black, and V_{out}(t) in magenta. The period, T (maroon), is shown from one upward zerocrossing of the input function to the next (shown by black dots). The delay T_{d} (green), is shown from an upward zero crossing of the input to the next upward zero crossing of the output (green dot). The phase is negative (since output lags input) and equal to ‑T_{d}/T·360°. So if the delay was T_{d}=T/4 (i.e., one quarter of a period) the phase shift would be 90°)
Note: all angles are given in degrees. They should be changed to radians before evaluation by calculator or computer.
Sinusoidal functions are important because functions of time can be broken down into a sum of sinusoids. Given a system given with a sinusoidal input, we can determine the output in a straightforward manner from the transfer function. These two facts, together, make the determination of a transfer functions to sinusoidal inputs a useful endeavor (and, ultimately, quite powerful).
The frequency response of a system is presented as two graphs: one showing magnitude and one showing phase. The phasor representation of the transfer function can then be easily determined at any frequency. The magnitude of the output is the magnitude of the phasor representation of the transfer function (at a given frequency) multiplied by the magnitude of the input. The phase of the output is the phase of the transfer function added to the phase of the input.
A Bode plot is simply a plot of magnitude and phase of a tranfer function as frequency varies. However, we will want to be able to display a large range of frequencies and magnitudes, so we will plot vsthe logarithm of frequency, and use a logarithmic (dB, or decibel) scale for the magnitude as well. We'll explore that in the next installment.
To get a more intuitive idea of what the frequency response represents, consider the system below. (Hit start button to show animation)
Click here for an animation of an analogous electrical system.
Animation by Ames Bielenberg
The transfer function of the system is given by (with m=1, b=0.5, k=1.6, u=input to system, y=output (the position of the mass):
The magnitude and phase plots are shown below.
The input is a sinusoidal function whose frequency increases with time. You can see by the animation that at low frequencies (and low times) the input and output are equal in magnitude, and in phase (after the initial startup transient dies out). This is shown by a magnitude of one and a phase of zero on the plots of magnitude and phase of H(jω). At intermediate frequencies (and times) the system is somewhat resonant, and the output actually gets larger than the input (but there is a growing phase lag, i.e., negative phase). As frequency increases further, the output decreases; again, you can see this both in the animation and in the magnitude plot. The outline of the peaks of the output plot is similar to the magnitude plot above. The phase is not as obvious, but it obviously starts at 0° and then decreases to 180° (you may need to zoom in to see the phase shift). At high frequencies (phase near 180°) the two waveforms are completely out of phase; when one is at a maximum, the other is at a minimum.