Description

here are some tips, I have attached the pages he’s talking about:

The project did not ask for h(t), that is very hard (mathematica can do it, but its messy). The project is asking you to solve it numerically, i.e. get h[n].

Get yourself a copy of the circuits book I wrote, if you dont have a copy, download the pdf from the internet for free. Look on page 224/225. This is a simpler case than the one in your project (obviously), but the methods are the same. I used Kirchoff’s laws and the laws for an inductor and a capacitor (all in the circuits book) to derive a system of first order ODE’s. For the example on page 225 I ended up with 3 first order ODE’s, then I solved it numerically (see the book). I solved the circuit in your project in a similar way, and ended up with 6 first order ODE’s. These I solve numerically as shown in the circuits book (Euler’s method). That gives me h[n].

Euler is very simple, and has stability issues. You can use more sophisticated numerical methods, such as Runga-Kutta – see Burden and Fairs (download for free from the internet). Remember you cannot use matlab build in ODE solvers. It makes it too easy. So the markers will want to see your method and code.

1) The project document is a guideline. You can change things if you find some other method to do the same job works better for you. As long as you can defend it, its ok. For example, to get the transfer function, you can just input a cos(omega*t). Many students stuff up the u(t) in matlab. I dont use the u(t) function in matlab, I just write the code with a test on the time variable to make sure it turns on and then off.

2) Use ode45 to check your results, especially your ODE’s. Because if ode45 doesnt give you correct results, it means your ODE’s are wrong.

3) You can guarantee a bandpass by choosing all 3 resonant frequencies identical. You may need to sample fine to see it, it will be very sharp if you do that.

4) You can also get the h(t) by having a rising exponential as an input (1-exp(-At)), this approximates the step function. Then numerically differentiate it. That gives you an approximate h(t). Then you start making your A bigger, then the rising exponential becomes a better approximation to u(t), and the derivative a better approximation to h(t). You can plot the results as you make A larger, then clearly see how the result converge to h(t). Of course it assume you sample fast enough.

More tips:

1) The circuit contains 6 energy storage elements, so circuit theory says it must be possible to write the circuit equations as 6 first order ODE’s. My system thus has 6 variables, each variable chosen appropriately for each energy storage element. I wrote a simple Euler solver (as in the circuits book) and tested it for a) impulse response b) step response and c) cos(wt). All 3 cases worked fine. You can use ode45 to confirm your results. You cant have ode45 in your report, we want to see your solver method and code, but you can use it offline to check your results. Here are some settings I used to get the bandpass near 100 Hz: L1 = 0.01/6; L2 = 0.01/6; L3 = 0.01/6; C1 = 0.01/6; C2 = 0.01/6; C3 = 0.01/6; R1 = 1; R2 = 1. R1 is an optional resistor connected to the input source, you could set it to zero like I did in the document. R2 is the output resistor. By shifting the resonant frequencies apart a bit you can make the bandpass a little more flat. But these simple settings should enable your to at least verify your ODE’s work.

2) When you use cos(wt) for the input, then the circuit output takes some time to get past its transients, then eventually settles in an equilibrium where its D cos(wt+phi). The value D is the transfer function at frequency w, i.e. |H(w)| = D. phi is the phase response, we are not measuring that. This is what my code (in the circuits book) does to get the transfer function that is shown there. Attached my input and output voltage for the settings above.

3) You can compute the step response, then differentiate that to get the IR h[n], that works also. I show my result for above settings.

You dont have to make your input voltage source like I suggested in the project document (using the tau and the Heaviside functions). You can make the input in any way you want to, as long as it does what it is supposed to do for each task. So you can make an approximate Dirac delta any way you want to. Or you can use an input step u(t) so that you compute the step response, then differentiate it to get the h(t). That is fine too. You can explain in your report what you did, and why it is correct.

For the cos(wt) to get the transfer function you can simply input that as Vi(t), you dont need the Heaviside functions. As long as you start your circuit from a state at rest (no energy was stored). I coded all my matlab without using any Heaviside functions, but the code does the right job. That is what counts. In theory the cos(wt) has to run for an infinite time. I will show you in part 2 of the unit why that is. But on a computer we cant wait infinitely long. So you wait until the transients have decayed away.

The document with handwriting has an explanation of page 255 of the book and also has references to matlab files which are attached.