Sunday, May 29, 2016

Circuits and Electronics - Damped Second Order Systems (Lecture 18)

Video and lecture notes:- edX    MITx: 6.002.2x Circuits and Electronics 3:  week 1


 An inductor here, a resistor and a capacitor is connected in series.The voltage across the capacitor is V(t), and the current in the series circuit is i(t).

With node voltage analysis at nodes V and V_A, we will be able to come up with some equations.

We will need to get rid of V_A. By equating , differentiating and arranging the equations, we will be able to get the second order equation.

The node method always works but there is another cute little way of getting the equation. And that is the KVL method.


To solve the differential equations, there are  three steps.The first step is to find the particular solution, vP. We will call this solution vP. The second step is to find the homogeneous solution.
And, as you recall from our solution of the LC circuit, the solution to the homogeneous equation will
result in vH. And we will do this in a four-step process. So step two of the solution involves finding the homogeneous solution, which itself has four steps. The third step of the solution is to find the total solution as the sum of the particular and homogeneous solutions.

Input will step from 0 to capital V_I at time t equal to 0.  And this input can be expressed as V_I, u(t). The u(t) is rhe  unit step. Let's pick the following initial conditions. Let's go ahead and solve it for the ZSR,  OK, so initial conditions will be these. Since it's a ZSR, v (0) would be 0. And similarly, i(t) will also be equal to 0.

If we try try v_p equals v_i, we will find that  v_p equals v_i is a particular solution.


v_H is the solution to the homogeneous equation which is the original equation with the drive set to zero.

And as you recall, I've been using a four-step method to solve the homogeneous equation.
OK, so let's write down what those four steps are. So there's a step 2A, there's a step 2B, there's a step 2C, and finally a step 2D.

(A) Assume a solution of the form vH is Ae raised to st, where A and s are unknowns.
(B) Form the characteristic equation
(C) Solve   the characteristic equation for the roots s
(D) Form v_H by summing up the two terms. A1 e raised to s1 t plus A2 e raised to s2 t.

For step (A) take v_H = Ae raised to st, and  substitute that into the differential equation.
For step (B), after some simplification we are left with a  characteristic equation and .compare the  characteristic equation with the canonic form
For step (C) we would need to find the roots s of the   characteristic equation.
For step (D) we would need to write the general solution to the  homogeneous equation which is A1 e raised to s1 t plus A2 e raised to s2 t.


With that we can write out the total solution and solve for the copnstants using initial conditions v(0)=0 and i(0)=0. Take note that i(t)= C dv/dt.

At first glance, the solutions do not seem  to be what we want so we need to take a look at the total solution again.


If we look at square root of alpha squared minus omega naught squared.  When alpha is greater than omega naught, the stuff inside the square root sign is positive, so I get a real value as a square root.
However, if that quantity, alpha squared minus omega naught squared, or alpha versus omega is such that it is negative-- in other words, if omega is bigger than alpha-- then I get a square root of a negative number so I get the imaginary value.

Let's look at the  three cases

The first case, as we discussed, is the pretty straightforward case when alpha is greater than omega naught. This case is called the overdamped case. Damping relates to R, and when R is very large, there is more damping, for whatever that means for now.

The second case is when alpha is less than omega naught, in this case the quantity under the square root sign becomes negative, and very interesting things happen. We call this the underdamped case.

And then, of course, the obvious third case, alpha equals omega naught. This is called the critically damped case.


For overdamping, when alpha is greater than omega naught, I can rewrite the total solution v of t. When the input and output waveforms are plotted, we can see for the ouput, there are no sinusoids. This case occurs when the resistance is large.

For underdamping, when alpha is less  than omega naught, we need to put in j as some the part of total solution would seem to be imaginary. Let's pick  omega d. as omega naught squared minus alpha squared.Omega d is called the damped natural frequency of the circuit. Omega naught is called the undamped natural frequency. As v(t) is real, the RHS must be real.  Now, notice that e to the j omega t and e to the minus j omega t I know are here, but the good news is that they are complex conjugates of each other.  OK, so there's a likelihood that, as I add things up, the imaginary parts will cancel out giving me a real number. Now it turns out that, given that these two are complex conjugates of each other, it turns out the only way that I can get a real number out of it is if A1 and A2 are complex
conjugates of each other. So A1 and A2 must be complex conjugates of each other as well. I see a VI there, plus notice that I have these cosines and sines floating around, and if A1 and A2 are complex
conjugates of each other, the final expression will be some constant K1 times e raised to minus alpha t, times cosine of omega dt plus some other constant K2 times e raised to minus alpha t times sine omega dt. Next, we would need to solve for the initial conditions where v(0)=0 and i(0)=0. When we check the expression for R=0, we will find that it is correct for the LC circuit.  Writing  v( t) based on the scaled sum of sines formula, we will get an equation for which we can plot the graphs. We will need to see what the graph of  v(t) against t looks like for a step input. When plotted we will notice that the sinusoid is decaying.

In the critically damped case when alpha is equal to  omega naught, we will; see that the waveform ius somewhere between that of the overdamped and underdamped case. ( a slight blip will be seen)

For the inverter pair RLC, we will see that the case is actually an underdamped one when a 50 ohm resistor is used.

The characteristic equation tells you what the waveform looks like. When connected to the canonic form of the characteristic equation. The quality factor  Q is approximately the number of cycles of ringing.

Another way of observing how the waveform looks like is by intuition. When i(0) is negative, the capacitor is discharging so the capacitor voltage is falling down.

It is possible to find V_L by finding out the rest of the voltages for the other components first or by KVL.

For the RLC circuit, the same method more or less applies but current is dealt with instead of voltage.






Saturday, May 28, 2016

Music On The Go: LMMS tutorial 3

I made some video tutorials to round up the basics of LMMS. Here is the first which is using the Control key to copy tracks

https://www.youtube.com/watch?v=dt4wWCkuQ-o


Here is the second one to move and  copy notes, with the  Shift key to copy notes.

https://www.youtube.com/watch?v=WNkD-UHQ4aA

Here is the third one which is an update of the first one on how to copy and paste tracks

https://www.youtube.com/watch?v=2aoT4rl05Xs

(updated 4/12/2018)

Monday, May 16, 2016

Music On The Go: LMMS tutorial 2: - Sidebar

Video:- https://www.youtube.com/watch?v=Ow4fHTmd1mo

First thing is to learn to load a project

After saving a project, to see it in load project, hit refresh button first.

In the instrument plugins, the most useful one is at the bottom -  ZynAddSubFx

You can load samples into My Samples

Presets are instruments. Bitinvader one of the sound files. ZynAddSubFx has many sound files. Right click to add instruments to the song editor

Instruments plugins can be dragged to use them .

Sunday, May 15, 2016

Music On The Go: LMMS tutorial 1 : Piano Roll, Beat/Bass Line Editor

I remember some time back when I learnt  Sony Acid Express for music but it seems LMMS is pretty good as well so I am checking out some tutorials on it.

Video:-https://www.youtube.com/watch?v=4dYxV3tqTUc

First check the settings.

Use Triple Oscillator to get to piano roll.

Quantisation helps to move and resize the notes.

Use control key and mouse scroll wheel   to zoom in and out.

The bass line editor on the right can fill in the drum beats

It is possible to add drum beats by opening up My Samples on the left.

Friday, May 6, 2016

Circuits and Electronics - Undamped Second Order Systems (Lecture 17)

Video Lectures:- http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-002-circuits-and-electronics-spring-2007/video-lectures/lecture-15-part-1/

Lecture Notes:- http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-002-circuits-and-electronics-spring-2007/video-lectures/6002_l15.pdf

 Second-order systems will have two independent energy storage elements.for example, have a capacitor and an inductor, or you might have two capacitors that are independent of each other.

We are going to get dynamics that are governed by second-order differential equations.

An inverter driving another inverter. is a perfectly good system to study for second-order systems.

The equivalent circuits for these two inverters consists of a  a five-volt supply V_S, two MOSFETS, load resistors and parasitic capacitance

The reason they are called them parasitic capacitances is that it's not something we usually see, but it's something that appears whether we like it or not.

We are going to look   at what the waveforms are going to look like at A, B, and C.

So let's say the waveform at A is some square wave that looks like this. 0 to 5, back down to 0, and then  up, to 5 again. So that is my waveform at A. So as a low voltage is applied  at V_A,  a high voltage is obtained at V_B. And then when A jumps up to a high value, Bgets pulled down low. So the B node gets pulled down low, and it goes down pretty fast. And the reason it goes down pretty fast, as you will, is that the on resistance of the MOSFET is very, very low. So when VA falls here, the first time transistor is going to shut off, and the node B needs to be pulled up to a high value.
Now notice that the capacitor is initially charged to a low value, C_GS, and it needs to charge up through the five-volt and the 2K resistor, and there's the C_GS.

So in this case, let's assume it's a pretty large time constant, the waveform is  going to start off at 0, and it will be rising  like a capacitor charging up.  Again, this is going to reflect some time constant. Tau, the time constant for this, would be reflective of two kilohms times C_GS.

Then when V_A rises again, V_B is going to drop. Because R on is very low, it's going to drop quickly. And then it's going to continue like this.


So V_C will start off at 0, because V_B is high. And then V_C goes up to five volts because V_B is low.  And then at this point, VB starts to rise. At some point, VB is going to rise high enough to hit the threshold value for the MOSFET at the second inverter. And so because the MOSFET turns on, as the voltage at B goes above the threshold value for the MOSFET whose input is B, the output is going to fall. So, at some point, the MOSFET output , the second inverter output, V_C is going to fall.  And then, as the signal at B goes down, the output at C is going to go up again.



As node B rose up slowly, the voltage took some time to get to VT, and because of that, there was a delay at C. So what do we do? We are going to try to speed up  node B by  reducing the time constant. We can say, hey, let's go change C_GS. But C_GS is there so it cannot be changed.

So we have to try to reduce R_L, the 2-kilohm resistor. To do that, a 50-ohm resistor is placed in parallel with the 2-kilohm resistor, together with  a switch. So when the switch is shut, then the 50-ohm resistor comes in parallel with the 2-kilohm resistor, making the effective parallel resistance more or less 50 ohms.

 At some point at B,   sharply rising waveform was expected to be seen  but instead,
an oscillatory waveform that seemed to oscillate, and decayed was seen.

So what we would see here for C-- is  a spike. What is happening is that there is a parasitic inductance connected in series with the parasitic capacitance. Together it will be seen that an RLC circuit is formed.


Let's do a simpler circuit, just the LC circuit. And that will itself give us a bunch of intuition.

The current through the capacitor, I know, is i(t), and that is simply given by C dv/dt.


 The same thing could be done for the inductor.  So recall for an inductor, the voltage across an inductor is related to L di/dt.  And in this case, what is the voltage? Well, that voltage is simply v_I minus v and that is simply equal to L di/dt.

The inductor current in the integral form will be equal to C dv/dt. When we differentiate both sides, we will get a second differential equation.

To solve this, we need to use the method of homogeneous and particular solutions. The method had three steps. The first step of those three was to find the particular solution.

The second step of the method was to find a homogeneous solution.

Here, there's going to be a slight variation. In finding the homogeneous solution, we are going to use
four steps to do it.

This will be a four-step process. And then, our third step is the usual third step of the method of homogeneous and particular solutions, which is to create the total solution, where the total solution is
the sum of the particular and homogeneous solutions. And then you use the initial conditions to solve for the remaining constants.


Find particular, find homogeneous solution, and that the total solution will be the sum of the particular and homogeneous.

Let's go ahead and pick a step input for v_I.

Let's pick  initial conditions for my two state variables, v across the capacitor and the current through my inductor.

So voltage across the capacitor at time t equal to 0 is 0. v(0)=0

And let's say the current through the inductor at time t equal to 0 is also 0.  i(0)=0

So in other words, what I am looking for is the zero-state response, because my initial conditions for both my state variables- the current through the conductor and voltage across the capacitor has been picked to be 0.


So the first step to solve the differential equation is to go find a particular solution. Any solution
for v_P that satisfies the particular equation  will be a solution. So in this case, let's guess v_P equals VI. By substituting, it can be seen that  v_P equals V_I is indeed a solution, so this is the particular solution.

The homogeneous solution, as we recall, is a solution to the differential equation with the drive set to 0.


A four-step method is used to find the homogeneous solution. So it's four steps as part of the global step 2. Say, steps 2A to 2D. So let me start with the first step 2A.

In most of the cases, you're supposed to know what the answer is roughly, and then you go and guess.
So now if we assume a solution of the form A e raised to st and  substitute that into the homogeneous equation.

An equation in s needs to be developed for A e raised to st to be a homogeneous solution..

This can be  done by taking A e raised to st and sticking it in place of v_H in the homogeneous equation here. And when that is done that, you'll be able to cancel out the A's and a bunch of other stuff, and then you will be left with an equation in s. So that equation in s will be called the characteristic equation.

We will  be left with LC s squared plus 1 equals 0.

This equation here in s is called a characteristic equation which  is an extremely important equation.


So the second step was to really write down the characteristic equation. So 2B was to write the characteristic equation which is  LC s squared plus 1 equals 0. And so that implies that s squared is equal to minus 1 by LC.

Step 2C will be to develop the roots of the characteristic equation, So in this case, s squared equals minus 1 by LC. So if the minus sign did not exist, s would simply be square root of 1 by LC, plus or minus that. Now, since a minus 1 exists, I stick in the square root of minus 1 out here, which is j.
So those are the roots of my characteristic equation, plus or minus j square root of 1 by LC.

Omega-naught is equal to  square root of 1 by LC.  So the roots of my characteristic equation are
plus or minus j omega 0.  Step 2D simply involves writing the general solution to the homogeneous equation.

So A1e raised to j omega 0 t is one solution. And the second one is the other root, Ae raised to minus
j omega-naught t. So this is the general solution to the homogeneous equation. A1e raised to j omega-naught t and A2e raised to minus j omega-naught t, which correspond to these two roots.

Then we reach the third step which is to create the total solution, which is the sum of the particular and homogeneous solutions. And then you use the initial conditions to solve for the remaining constants.

If v(0)= 0, so at time t equal to 0,  we get V_I. And if I substitute time t equal to 0 here and here, we just get A1 plus A2.

i (t)=C dv/dt. So I'm told that that is 0.  So dv/dt of the first part is a constant, so that is 0.
So if we differentiate  the second part with respect to t, we get j omega naught coming down, and e raised to j omega naught t.

And then, for the next part, we get minus C A2 j omega naught e raised to minus j omega naught t. So I just obtained dv/dt of this one and multiplied that out by C.

So this evaluated at t equals 0 is simply C A1 j omega naught minus C A2 j omega naught.
And that equals 0.
.
So I can simplify that. So C and C cancel out. j omega naught and j omega naught cancel out.
So I get A1 equals A2.

With the help of the other equation, A1 will be minus VI divided by 2. So therefore, A1 equals VI divided by 2, and that is also equal to A2

If we substitute the values of A1 and A2, we will get an equation where part of it seems familiar.

And the thing that comes to mind whenever you see e raised to j something plus e raised to minus j something, where j is the square root of minus 1, is the Euler relation. Eventually we get an equation which involves cos omega naught t. As i(t) is equal to C dv/dt, we get an equation which involves sin omega naught t for i(t).

When we plot the graph of v(t) with omega naught t as the  x axis, we get  a sinusoid output for a step input voltage and secondly, the voltage actually was higher than the input voltage that I had in my circuit.

When we plot the graph of i(t) with omega naught t as the  x axis, we also get  a sinusoid output.


So the overall structure of the method had the following steps.

(1) Write the differential equation for the  circuit by applying the node method.

(2) Find a particular solution v_P by guessing at a solution.

(3) Find the homogeneous solution by using  four steps.
     (a) Assume solution of the form A e raised to st.
     (b) Obtain the characteristic equation.
     (c) Solve   the characteristic equation for the roots s
     (d) Form v_H by summing up the two terms. A1 e raised to s1 t plus A2 e raised to s2 t.

(4) Then I obtained the total solution by summing up the particular and the homogeneous solutions.
      And then I solve for the remaining constants using the initial conditions.

For the undriven LC circuit, the input voltage is equal to zero, so the homogeneous equation can be used to find the response of the circuit.

My initial conditions are given here.

For v_c(0)=V, I get V = A1 + A2.
For i_c(0)=0, as i=C dv/dt, A1=A2


So we eventually get A1 =A2 = V/ 2.

So in terms of my solution, I can write down vc of t is equal to A1 e raised to j omega 0t plus A2 e raised to j omega 0t where A1 and A2 are both V divided by 2. So I can write that down as V/2 times e raised to j omega 0t plus e raised to minus j omega 0t.  And from that, because I know from Euler's relation e raised to j omega 0t plus e raised to minus j omega 0t divided by 2 is simply cosine omega 0t. So this is simply V cosine omega 0t.

And for the current ic, it is simply c dv/dt which is CV  minus omega0 sine omega 0t.

I just stuck a little capacitor and inductor together with the initial condition on the capacitor. And what that is telling me is that if I did that, that circuit will simply sit there and oscillate. The voltage will go back and forth between across the capacitor, then across the inductor. The energy goes  back and forth.

If we plot graphs of  v_c and i_c, with omega 0t as the x axis, a cosine and sine curve is obtained.


The energy graphs are more  interesting. Let's say the energy in the capacitor is E_C, and the
energy in the inductor at any given point in time is E_L.


So for the energy plot, I use 1/2 CV squared for the capacitive energy. So for the capacitor, the energy is 1/2 CV_C squared. And for the inductor, the energy is 1/2 LI_C squared.

If V was the initial voltage of the capacitor, then that is at any given point. Then at the peak, the energy across the capacitor will be 1/2 CV squared, where we were given that the voltage across
the capacitor at V(0)  was capital V. Similarly for the inductor, we can draw the same.

We can take 1/2 LI squared.And this is what we get, and so on. And in this case, what is interesting is that the energy stored across the capacitor initially, which is 1/2 C capital V squared, and then the energy sloshes back and forth between the inductor and capacitor.

The total here is the same as the total for the peak for the capacitor which is  1/2 C capital V squared.


So 1/2 CV_C squared plus 1/2 LI_C squared is equal to the total initial energy in the system, which is 1/2 C capital V squared, where V was the initial voltage across the capacitor.

When a resistor is introduced, there will be damping.