physical systems analysis laboratory 2: impulse response
TRANSCRIPT
1
Physical Systems Analysis Laboratory 2: Impulse Response
Jeff Santner, Nick Villagra, Rio Akasaka Swarthmore College Engineering
Performed February 14th, 2007 Turned in February 28, 2006
Fourier Components courtesy of Lynne Molter
2
Introduction
Fourier series are an important method of mathematically representing a periodic
signal with an infinite summation of sinusoids. The coefficients of the Fourier series
equation can tell us various traits of the signal’s behavior. For example, large coefficients
correspond to larger amplitudes, and a0 corresponds to a vertical shift. If the coefficients of
sine are more significant than of cosine, then the function will be more like an odd function,
and vice versa. Larger coefficients at higher values of n correspond to more noise, or other
fast changes in a signal. Simply by observing or changing the coefficients in the equation,
we can easily analyze or manipulate the signal. The purpose of this experiment is to observe
how direct application of the trigonometric Fourier series formula to obtain the Fourier
coefficients can accurately model a square wave input and a circuit’s output. To intuitively
grasp the modeling process, we collected data from incrementally increasing values of n,
thereby deconstructing the square wave input and circuit output, and observing that as n
increases, the summation of the sinusoids becomes increasingly more representative of the
input and output.
Theory
The concept of a Fourier series is remarkable, and is crucial to this experiment. A
Fourier series represents a function as the sum of sine and cosine waves with frequencies that
are integer multiples of the frequency of the original function, plus a constant. Any function
can be represented by this sum if it is periodic, has a finite number of discontinuities in each
3
period, and has a finite number of maxima and minima in each period. The general form of a
Fourier series is given by equation 1
[0 01
( ) cos( ) sin( )n nn
]0f t a a n t b n tω∞
=
= + +∑ ω (1)
Where the coefficients are:
1 0
1
00
2 ( )cos( )t T
nt
a f t nT
ω+
= ∫ t dt (2)
1 0
1
00
2 ( )sin( )t T
nt
b f t nT
ω+
= ∫ t dt (3)
Also, a0 is the average value of the function:
1 0
1
00
1 ( )t T
t
a fT
+
= ∫ t dt (4)
In the experiment, we used a square wave that passes through the origin. This
function is odd, so it cannot contain any cosine terms, so an=0. Also, a0=0 because we
centered the wave, causing its average value over one period to be zero. To calculate bn, the
integral must be calculated using the relation 00
2Tπω = .
( )
1 0
1
00
0
00
0
00
2
0 00 0
2
20 0 0
0 0 0 2
0 0
2 ( )sin( )
2 sin( ) sin( )
2 1 1cos( ) | cos( ) |
2 1 cos( ) 1 cos(2 ) cos( )
t T
nt
TT
nT
TT
n T
n
b f t n t dtT
b n t dt n t dtT
b n t n tT n n
b n t n tT n
ω
ω ω
ω ωω ω
π πω
+
=
⎛ ⎞⎜ ⎟= −⎜ ⎟⎜ ⎟⎝ ⎠⎛ ⎞
= − − −⎜ ⎟⎝ ⎠⎛ ⎞
= − − − +⎜ ⎟⎝ ⎠
∫
∫ ∫
n tπ
4
Now, for all integers n, ( )cos(2 ) 1 and cos( ) 1 nn t n tπ π= = −
( )( )( )( )
0
0
01
odd
2 2 1 22
2 1 1
4 n is odd
0 n is even4( ) sin( )
nn
nn
n
nn
TbT n
bn
b n
f t n tn
π
π
π
ωπ
∞
=
⎛ ⎞= − − −⎜ ⎟⎝ ⎠
= − − −
⎧⎪= ⎨⎪⎩
= ∑
It makes sense that only odd multiples of the base frequency are present. Even
multiples have the wrong symmetry, as shown in the figure below:
-3 -2 -1 0 1 2 3
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
S quare WaveF requency of 2F requency of 3
Figure 1: Symmetries of different frequencies
The wave with an even frequency has an equal number of peaks and valleys under each piece
of the square wave, but a sine wave with an odd frequency has more peaks than valleys
where the square wave is at a maximum, and more valleys than peaks where the square wave
5
is at a minimum. So, an infinite series of sine waves with odd frequencies could add up to a
square wave.
The circuit in the experiment is an RC circuit with the output across the capacitor.
Treating the circuit as a voltage divider and using complex impedances gives:
0
11
1 1C
in C R
V Z j CV Z Z j RCR
j C
ωω
ω
= = =+ ++
The magnitude of this is ( )2
11 RCω+
, so the circuit allows low frequencies to pass through.
We used a low pass filter because of the inaccuracies of our function generator. If the output
of a low pass filter was represented as a Fourier series, it would contain much higher
amplitudes at low frequencies than at high frequencies. This is important because we wanted
to recreate the output using a Fourier series, and our function generator cannot generate noise
free signals at high frequencies. So, using a low pass filter allowed the output due to a square
wave to be approximated by a few low frequency waves.
The circuit used contains only linear elements, so the behavior of the circuit is linear.
This means that the output fout due to a certain input fin is equal to the sum of two outputs gout
and hout if fin is the sum of the corresponding inputs, gin and hin. If the individual sine waves
that add up to a square wave were used as the input to the circuit, then the outputs from each
sine wave would add up to the output due to a square wave.
6
Procedure We first assembled an RC circuit as shown below:
Figure 2: Schematic for RC circuit assembled for this experiment
An oscilloscope was used to measure the voltage across the capacitor and the square
wave input from the function generator. We then collected the data for one full period of the
square wave using Excel’s Agilent function. To model the square wave, we used the
trigonometric Fourier series to create sinusoidal inputs. We incrementally increased the
frequency of the sinusoidal input by odd integer multiples of the square wave’s frequency,
and captured the data until we had six sets of data for when n=1,3,5…11 of the trigonometric
formula. We summed the functions of the sinusoidal inputs for the first two components, and
then the first three components, and so on until all six were summed together.
7
Gibbs Phenomenon
When summing the sinusoidal inputs, we observed that the Fourier model would
overshoot the value of the voltage at the point of oscillation in the square wave input, an
occurrence known as Gibbs Phenomenon. The overshoot with the summation indices are
shown below:
N Overshoot (V) Overshoot-Initial Amplitude Distance (V)
% Overshoot of Amplitude
Error (%)
1,3 0.325 2.18 14.9 17 1,3,5 0.361 2.15 16.8 6.7 1,3,5,7 0.373 2.13 17.5 2.8 1,3,5,7,9 0.373 2.13 17.5 2.8 1,3,5,7,9,11 0.464 2.21 21 14
Table 1. Tabulates the overshoot and the error percentage for experimental data
The overshoot values were obtained by finding the maximum voltage value of the
input and then subtracting from the maximum voltage value of the output. The percent of the
overshoot to the amplitude was found by taking the ratio of the overshoot to the distance
between the maximum value of the input and the minimum value of the output. We can see
that as the number of permutations increases, the percent of the overshoot to the amplitude
does not dissipate. Within the error shown in the table above, the results of the overshoot to
jump ratio are comparable to the generally accepted ratio of 18%.
8
Results
The following graphs are the experimental data extracted using Excel’s Agilent
function, plotted using Matlab. The square wave had a frequency of 10Hz, and the resistor
and capacitor values were chosen such that their time constant τ (RC) was 0.01 seconds.
Graph 1: Square wave response
The above graph shows the input from the 10Hz square wave generated by the signal
generator, and the output measured across the capacitor as a response to the signal.
9
Graph 2: RC circuit response to Fourier series component with n=1, or sine wave.
The above graph shows the input and output across the capacitor for an input sine
wave of amplitude 4/π and frequency of 10 Hz.
10
Graph 3: Sum of two sine waves and the corresponding summed output.
The above graph shows the addition of the previous graph with the input and output
across the capacitor for an input sine wave of amplitude 4/3π and frequency of 30 Hz.
11
Graph 4: Sum of three sine waves and the corresponding summed output.
The above graph shows the sum of three sine waves at the odd coefficients of n=1,
n=3, and n=5. We see a clearer representation of the square wave, as well as a significantly
improved response on the part of the capacitor.
12
Graph 5: Sum of four sine waves and the corresponding summed output.
We see smaller sine wave formations at the top of the input signal indicating the
summation of finer Fourier components. The response does not seem to vary much at this
point.
13
Graph 6: Fourier series with the sums of components with n=1, 3, 5, 7 and 9
We see that the error continues to decrease slightly with the addition of more sine waves.
14
Graph 7: Graph of Fourier series components up to n=11.
As the n increases, we see that the addition of more waves does not have a great
effect. This is because the amplitude decreases greatly. For example, when n=11, the
amplitude of the input wave is 4/11π.
15
Theoretical response using MultiSim
Data were collected after constructing the circuit shown in Figure 2 using MultiSim’s
Grapher function and plotted in MultiSim. Since MultiSim extracted 10063 data points, we
observe the very smooth form of the input and output signals
Graph 8: Simulated total response using MultiSim
16
Theoretical input and response using Excel
To construct a theoretical graph that depicts both the input in the form of a step and
the output response across the capacitor for the total sum, the following method was used:
In the first column of Excel, the time intervals that were obtained using Agilent in the
extraction of data from the signal analyzer were copied. In the second column, the input in
the form of a step response was added. This required putting the value of 1 (1 Volts) for the
time period of zero to 0.05 seconds, and -1 for the time period of 0.05 to 0.1 seconds, to
correspond with our data and the 10Hz square wave used in the experiment.
In the third column, one of two equations was placed,
For the time period between 0 and 0.05 seconds
(2*(1-2.71828183^(-t/0.01)))-1
which corresponds to the general form of the equation of the voltage measured across
a capacitor due to an input:
(1 )t
RCC inV V e
−= −
The input voltage is 2 because this is the peak to peak amplitude of the voltage, and
we can consider the square wave to be a step function of amplitude 2 shifted down by
1 volt. (see Figure 3 on the following page)
For the time period between 0.05 and 0.1 seconds
(2*(2.71828183^(-(t-0.05)/0.01)))-1
which corresponds to the general form of the equation of the voltage across the
capacitor
( )t
RCC inV V e
−=
17
Figure 3. Two ways to represent the same square wave.
Figure 4. Screenshot of Excel tables showing the method by which the theoretical output was obtained.
18
Graph 5. Theoretical 10Hz square wave input and output across capacitor as shown in Excel.
Fourier Series components approximation using Excel
The same method as described above was used to approximate the response of the
circuit based on a signal of our Fourier series components. This time, however, it seemed
most relevant just to plot the first half of the period, since it would make comparing the
waveforms much easier.
19
20
We can see that as the number of Fourier series components increases, the response
becomes close to that of an exponential curve, as expected. Since Excel only allows a certain
length for formulae to be added, the maximum number for n that was used for the above
graph was n=41. Had more values of n been summed, we would notice fewer small
oscillations and a better approximation to the response we expect from a RC circuit.
Error Considerations
The most significant source of error in this lab experiment results from the noise
generated from the fact that we used an input of very high frequency. Since the time scale
could not be altered, the change of frequency meant more oscillations during the same time
period. Furthermore, the sweep of the oscilloscope is limited, causing distortion in the time
between the sweep. An improvement that could have been performed on this experiment
was to decrease the window of the oscilloscope reading so that we could observe one period
only (instead of the current two periods) so each sweep of the oscilloscope could add more
relevant points, rather than noise.
21
Discussion
The graphs of our square wave input and RC voltage output were comparable to the
theoretical results we obtained. Voltage in both the theoretical and experimental graphs
oscillated periodically between concave down exponentially increasing and concave up
exponentially decreasing values. The only discrepancy aside from expected noise in the
experimental graph was that the voltage output did not reach the maximum value of the
voltage input. This may have happened because the capacitor we used did not reach full
capacity before discharging.
The graphs of the sinusoidal input appeared as we would expect for their respective
value of n in that as n increased, the summation of the sinusoidal inputs yielded an
increasingly accurate representation of the square wave input. However, the accuracy of the
representation did not increase at a constant rate; as n increased, the marginal increase in
accuracy of the Fourier model decreased.
Conclusion and Future Work
The results have shown that a sinusoidal input using the derived Fourier coefficients
gives a close approximation to a square wave input and the output of an RC circuit. This
discovery validates the usage of the Fourier coefficients in manipulating the signal or
analyzing its properties such as amplitude or phase shift. However, this experiment could be
improved by incorporating other kinds of signals in addition to the square wave input (i.e. a
triangular input) to observe the extent to which the trigonometric Fourier formula can be
used.
22
To have a more thorough understanding of the signal, we could also analyze its
behavior in the frequency domain. This could be achieved by finding the Fourier transform
of the signal, applying the formula 1( ) ( )2
jwtF w f t e dtπ
∞−
−∞
= ∫ .
Bibliography
"Gibbs Phenomenon." Wikipedia. (2006) Online.
http://en.wikipedia.org/wiki/Gibbs_phenomenon Feb 26, 2007.
Acknowledgements
Grateful acknowledgement is made to Prof. Moreshet and Prof. Molter for frequent
guidance in the completion of this experiment, as well as the write-up that followed it.