Lab 1: Passive Filters, Linear Regression and Fourier Series
Requirement for Lab report
1.Derivation in writing, or typed up in L ATEX or MS Word 2.MATLAB/Octave code or script with proper comments 3.Graph resulting from the MATLAB/Octave code or script 4.Brevity will be rewarded
 The lab is due ONLINE on Friday (Sept 27th)
(Q1). Passive First Order Filter: The response of an AC signal to capacitance and induc tance is frequency dependent with 90^{o} phase gap. However, when combined with a resistor, both the magnitude and phase responses are dependent on frequency. For the below given circuit
V_{L}

+ L +
+
Vs R VR
− −
 Derive the response of voltage (magnitude and phase) across inductor ( V_{L}) and resistor (V_{R}) given the AC Voltage signal V_{s}. Write the response in non
dimensional terms i.e. and ω ω_{c}?
ω
instead of
ω_{c}
ωL
R . What is the response for ω ω_{c}
 Write a MATLAB/Octave function that observes the frequency output for this

circuit. The inputs of the function are the values of capacitance L in Henry, resistance R in Ohms and range of frequencies (vector of frequencies from f_{1} to f_{2} f_{range} = f_{1} : (step) : f_{2}).
Hint:
Input format – plotRLResponse(freqRange, R, L) where
freqRange = range of frequency. Units – Hertz(Hz) : 1 × N row vector
R = resistance value expressed in Ohms (Ω): 1 × 1 scalar
L = inductance value expressed in Henry(H) : 1 × 1 scalar
(Q2). Butterworth Filter: First order filters do not generate flat frequency response. To obtain flatter responses, higher order filters are used. For the below given filter
L_{1} L_{3}
 Show that for AC voltage signal of V_{s} = exp (iωt) and known values of
L_{1}, C_{2}, L_{3}, R_{4}.
V_{out} (iω) R_{4}
=
(2.1)
V_{s} (iω) (iω)3(L_{1}C_{2}L_{3}) + (iω)2(L_{1}C_{2}R_{4}) + (iω)(L_{1} + L_{3}) + R_{4}
The denominator is third order polynomial in ω, hence, the filter is 3rd order. What is the response of the filter at ω → 0 and ω → ∞?
 For L_{1} = 3H, C_{2} = 2/3F, L_{3} = 1H, R_{4} = 2Ω show that the gain varies with angular frequency ω in the following manner
Vout V_{s}
1
= √1 + ω6 (2.2)
Plot this response in MATLAB/Octave and compare it with equivalent first
order normalized response (Q1 for ω_{c} = 1) of
Vout V_{s}
1
= √1 + ω2 . For nth order
filter the response is
Vout
V_{s}
1
= √1 + ω2n . Compare previous responses with
that of higher order filters – n = 4, 5.
(Q3). Wheatstone Bridge: Bridge circuits are a common way to measure component val ues by comparing them to known values. Often an unknown element is put in one arm and then the bridge is nulled by adjusting the other arm or varying the frequency. Wheatstone bridge comprises of four resistors and is used to measure unknown electrical resistance. A wheatstone bridge has ability to provide extremely accurate measurements unlike a voltage divider.
V_{s} Q
 The wheatstone bridge is called to be balanced when the voltage difference between points P and Q is zero, i.e. V_{G} = 0. Find the relationship between the resistances R_{1}, R_{2}, R_{3}, R_{x} for the case when the bridge is
 For the case when the bridge is not balanced, find the voltage drop V_{tt} in terms of resistors and V_{s}
(Q4). Linear Least Squares: Linear regression can be viewed as minimization of least squares error. For a linear relationship between dependent variable y and indepen dent variable x, m, c denote the linear unknowns.
y = mx + c (4.1)

For N data points (x_{i}, y_{i}) i [1, N ] The error e_{i} between the measured quantity and the model predicted value is
e_{i} = (mx_{i} + c − y_{i}) (4.2)
 Rewrite the error as
2 3 2
e_{1}
3 2 3
x_{1} 1 y_{1}
6 e2 7
6 x_{2} 1 7
 y2 7 m
e = Az − b, where e = 6
7 A = 6
7 b = 6
 z =
6 7 6 7 6 7


4 5 4 . . 5 4 5 b
e_{N} x_{N} 1 y_{N}

Prove that the solution to min 1e2 is
z^{∗} = A^{†}b
(4.3)
where the pseudoinverse A^{†} = (A^{T} A)^{−}^{1}A^{T} . This is commonly referred to as the linear least squares method.
 For the below given data, the relationship between y, x seems linear
y = a_{1}x + a_{2} (4.4)
Using linear least squares method, write MATLAB/Octave code to find a_{1}, a_{2}
y

4
3
2
1
0 x
0 1 2 3 4
 For the below given data, the relationship between y, x is modeled as
y = a_{1}x + a_{2}e^{x} + a_{3}
Find a_{1}, a_{2}, a_{3} by linear least squares method. Write the code in MALTAB/Octave.
y

16
12
8
4
0 x
1 2 3 4 5
(Q5). Fourier Series: Fourier series allows representation of complicated signals as super position (linear combination) of sine and cosine waves utilizing the orthogonality between the trigonometric functions. Any signal can be represented as a sum of N sinusoidal terms

S (t) =
a0 + X
a cos
2πn
t + b
sin
2πn
t (5.1)
i.e., for n, m ∈ I
N
Z T /2
2 n T
n=1
2π 2π
n T
0 ,m ƒ= n
−T /2
Z T /2
−T /2
Z T /2
cos
sin
nt cos
T
2π
nt sin
T
2π
mt dt =
T
2π
mt dt =
T
2π
T ,m = n


0 ,m ƒ= n
2
−T /2
cos
nt sin
T
T mt dt = 0, ∀m, n
 Show that
Z T /2
−T /2
cos
2π
nt dt =
T
Z
Z T /2
−T /2
sin
2π
nt dt = 0
T
2
a_{n} = T
T /2
−T /2
S_{N} (t) cos
2πn
t dt (5.2)
T
2 Z T /2
b_{n} = T
−T /2
 For a periodic square wave function
S_{N} (t) sin
2πn
t dt (5.3)
T
Ssquare
(t) = +1, t ∈ [−T /2, 0]
−1, t ∈ (0, +T /2]
(5.4)
show that the Fourier Series representation is
S_{N} =
XN
n=1
4
sin
(2n − 1)π
2π
T (2n − 1)t (5.5)
Write a MATLAB function squareFourierWave(N) that plots the sum of the N terms of the obtained Fourier Series. Observe the plots as N increases from 2, 4, 8, · · · , 1024 and compare with the original piecewise continuous function.
 Similar to previous part, find the Fourier Series coefficients for the following periodic Sawtooth Wave function
Ssawtooth(t) =
2t
(5.6)
T
Write a MATLAB function sawtoothFourierWave(N) that plots the sum the first N terms of the series.
Last Updated on September 18, 2019 by EssayPro