Categories: Help me Write Essay

Passive Filters, Linear Regression and Fourier Series

 

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 90o phase gap. However, when combined with a resistor, both the magnitude and phase responses are dependent on frequency. For the below given circuit

 

 

VL

 

 

+         L              +

+

Vs                                                 R     VR

−                                  −

 

  • Derive the response of voltage (magnitude and phase) across inductor ( VL) and resistor (VR) given the AC Voltage signal Vs. 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 f1 to f2 frange = f1 : (step) : f2).

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

 

 

L1                    L3

 

  • Show that  for  AC  voltage signal of  Vs = exp (iωt) and known values of

L1, C2, L3, R4.

 

 

Vout ()                                                 R4                                           

=

(2.1)

 

Vs ()        ()3(L1C2L3) + ()2(L1C2R4) + ()(L1 + L3) + R4

 

The denominator is third order polynomial in ω, hence, the filter is 3rd order. What is the response of the filter at ω → 0 and ω → ∞?

  • For L1 = 3H,  C2 = 2/3F,  L3 = 1H,  R4 = 2Ω show that the gain varies with angular frequency ω in the following manner

 

 

Vout Vs

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 Vs

1

= √1 + ω2 . For nth order

 

filter the response is

Vout

 

Vs

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.

 

 

 

 

 

 

 

Vs                                                                Q

 

 

 

 

 

 

 

  • The wheatstone bridge is called to be balanced when the voltage difference between points P and Q is zero, i.e. VG = 0. Find the relationship between the resistances R1, R2, R3, Rx for the case when the bridge is
  • For the case when the bridge is not balanced, find the voltage drop Vtt in terms of resistors and Vs

 

 

 

(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  data points (xi, yi)  i     [1, N ] The error ei between the measured quantity and the model predicted value is

 

ei = (mxi + c yi)                                                   (4.2)

 

 

  • Rewrite the error as

2        3         2

e1

3        2        3

x1     1                 y1

 

6 e2 7

6  x2     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

 

eN                  xN     1                 yN

 

z     2

Prove that the solution to min 1||e||2 is

z = Ab

(4.3)

 

 

where the pseudoinverse A = (AT A)1AT . This is commonly referred to as the linear least squares method.

  • For the below given data, the relationship between y, x seems linear

 

y = a1x + a2                                                  (4.4)

 

Using linear least squares method, write MATLAB/Octave code to find a1, a2

y

x y x y
0 0.76934 2.25 2.1652
0.25 0.63397 2.5 2.6331
0.5 0.84662 2.75 2.9506
0.75 1.3108 3 3.2752
1 1.8832 3.25 3.5736
1.25 1.4951 3.5 3.3965
1.5 1.9678 3.75 3.1896
1.75 2.0061 4 3.5644
2 2.5293 4.25 3.6721

 

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 = a1x + a2ex + a3

Find a1, a2, a3 by linear least squares method. Write the code in MALTAB/Octave.

y

x y x y
0 0.65388 2.25 2.87462
0.25 0.708971 2.5 3.71765
0.5 1.72722 2.75 4.82369
0.75 0.979738 3 5.6908
1 0.747464 3.25 7.4943
1.25 2.29931 3.5 9.32481
1.5 2.38776 3.75 10.8799
1.75 1.99884 4 14.0756
2 1.79418 4.25 18.0808

 

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

 

 

N

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

 

T ,m = n
2

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

an = T

T /2

 

T /2

SN (t) cos

2πn

t    dt                              (5.2)

T

 

2 Z T /2

bn = T

T /2

  • For a periodic square wave function

SN (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

 

 

 

SN =

XN

 

n=1

4

sin

(2n − 1)π

2π

(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.