Sunday, July 3, 2016

Circuits and Electronics - Time Domain Versus Frequency Domain Analysis (Lecture 22)

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


Identifying the time domain behavior of the circuit is easy from the impedance analysis.
Because if you recall, for our RLC circuit, Vc over Vi from the previous video was given by omega naught squared divided by s squared plus 2 alpha s plus omega naught squared. The s was equal to j omega. Now, you can get the time domain behavior completely from this equation here. OK, if you recall, at a given point in our analysis, we had substituted e to the st for a response, and when we
differentiated e to the st with respect to time, we got s e raised to st. And the e raised to st things canceled out. So each time you saw a d by dt, we ended up with an s in our equation.

So what we can do is  a reverse mapping. So wherever we see an s, we can go and stick in a d by dt
there and derive the differential equation in a backward step. Wherever you see an s squared, stick in a second derivative.

However, just for kicks, let's say we care about a step input. So for example, let's try a step input.
So for a step input, the input signal will simply be some dc value starting at time t equal to 0.
There you go. So I've very quickly written my differential equation for a step input for the same circuit completely by using frequency domain analysis.

 As before, even if I did the time domain analysis, my Q is the same, omega naught by 2 alpha, and
for the series RLC circuit, 2 alpha is R divided by L. So I ended up with omega naught divided by R over L, which is Q.  We will look at using  Q at both time domain and frequency domain behavior.


For  the frequency domain, we would apply a sinusoid  given by Vi cosine omega t. For the time domain, just for fun, we are going to use a unit step.   And as we have seen in the past, we can do the analysis in three cases.

So one case is for overdamped behavior. So for this overdamped behavior, alpha is greater than omega naught.  And in terms of Q, Q-- which is equal to omega naught by 2 alpha-- is less than 1/2.

Then for alpha less than omega naught, or Q--which is still omega naught by 2 alpha-- is greater than 1/2. this is high Q. This is underdamped.

And then, finally, a look at alpha equals omega naught. And in this case, Q equals 1/2. This is critically damped.

With the over-damped case,  alpha is greater than omega naught. This is the over-damped case. In one case,  a sinusoid is applied at the input and  the frequency response is measured. We are going to measure the magnitude of Vc/Vi, the magnitude of the transfer function for the frequency response. For the time domain part, we are  going to apply a unit step and   observe for what v_C looks like.

For the frequency domain behavior, it looks like a low-pass filter. It's low-Q, no peakiness.
And at the time domain,  there is a pretty sluggish circuit, which just goes up lazily and saturates at unity.

For the  underdamped case,  alpha is less than omega-naught. And so therefore, Q will be greater than half. Again, this is the case where I'm going to get a high Q circuit. So in this case, what's going to happen is that at omega-naught, because I have a high Q filter, I am going to get a peaky response.
The bandwidth is defined as the interval between the points in the curve where the response falls to 1 by square root 2 of the peak value. And 1 by square root 2 is 0.707. And sometimes it's also called the 0.707 frequency at which you reach the 1 by square root 2 value. Either way, it's a narrow band, and it's a very high Q filter. What happens in the time domain? Underdamped circuits gave rise to a lot of ringing. They were not sluggish. So for this capacitor's circuit, it would eventually settle down at 1.
So for instance, if I have a Q of 50, then the circuit is going to sit around ringing for about 50 rings.
And of course, notice that if I make R close to 0, if R goes close to 0, then this just becomes LC.
And recall, for an LC circuit, it will ring forever. Provide a unit step, they will simply ring forever
and ever and ever. Because Q for that circuit would be infinity when R goes to 0. So the key here is that in the time domain, Q relates to how ringy the circuit is. Q relates to ringiness. And in the frequency domain, Q relates to peakiness.


Finally, let me look at the critically damped case where alpha equals omega naught or, equivalently, Q equals half. Same circuits, input sinusoid for the frequency domain analysis and unit step for the time domain analysis. So in the case of my frequency domain analysis, let me first draw out clearly, at the very low and very high frequencies, the circuit behaves similarly. And it will look something like . . . 'bloop'.  Next, let's look at the time domain behavior of the same circuit and for the step input. I just get a little, little blip. It may be seen that  correlated to a flipped version of the time domain
step response but don't get confused by that.


Thursday, June 30, 2016

Circuits and Electronics - Filters (Lecture 21)

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

Lecture Notes:- http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-002-circuits-and-electronics-spring-2007/lecture-notes/

We often build special circuits known as filters  to eliminate that specific frequency of 50 to 60 Hz from the signal as AC in most countries are at 50 or 60 Hz. Otherwise we end up with a very low hum.

First, we need to plot the graphs of impedance against omega  for capacitors, resistors and inductors.
For very low frequencies, the impedance of the capacitor is very, very high. The capacitor looks like an open circuit but for very high frequencies, the capacitor looks like a short circuit. So for the capacitor, we will be able to see  the curve that shows its impedance.

For a  resistor R,  its behavior is frequency independent. So its impedance is simply R. And so it is
going to be a constant.

For the inductor, notice that for  very low values of omega, the impedance  is very low, and for high values of omega, the impedance is very high. Not surprisingly, the inductor looks like an open circuit to high frequencies and for DC and very low frequencies, the inductor looks very much like a short circuit.


So let's start with a CR circuit. If we plot the magnitude of H of omega of the transfer function for this filter, what does it look like?
So let's start with the high frequencies just for fun. For very high frequencies, note that the capacitor is a short circuit. And the resistor, of course, has a resistance R. So the capacitor is a short circuit and so Vi will appear directly at Vr. So for very high frequencies, my filter will give me Vi at Vr. So Vr divided by Vi will simply be unity.

What about for very low frequencies? At very low frequencies, the capacitor behaves like an open circuit. And if that behaves like an open circuit, then most of the voltage drop will be across the capacitor and very little will drop across the resistor and so I'm going to get a very low value. So low value for low frequencies and high values for high frequencies. So what we will get is a high pass filter.

 These same principles apply for an RC circuit.  So for an RC circuit, we will get a low pass filter.

 For an RL circuit, at low frequencies,  the inductor behaves like a short circuit so  H of omega  will have a low value. At high frequencies, the inductor behaves  like an open circuit, so H of omega  will have a high value. The RL circuit will be a high pass filter.

For an RLC circuit with the output voltage  measured across the resistor,  a  bandpass filter is produced. At resonance, omega equals omega0  which is  1 by square root of LC  and H of omega will be equal to 1.

For an RLC circuit with the output voltage  measured across the capacitor and inductor,  a  bandstop filter is produced. At resonance, the output voltage is zero.

For an RLC circuit with the output voltage  measured across the capacitor and inductor in parallel,  a  bandpass filter is produced. At resonance, the output voltage is zero. A major application of bandpass filters is in AM radio.  The capacitor is made variable so that the bandpass filter can tune to various frequencies.


How does the radio work?
On the x axis of the graph  is the frequency of the signal. On the y-axis, is the  signal strength.
So the way radio system work is that different radio stations would be transmitting at different frequencies. So, for example, in the Boston area, there are a bunch of radio stations that transmit the following frequency. So for example, one of the radio stations is 1030 in the Amplitude Modulation band, And then,there may be  other signals being transmitted by other radio stations. So for example, there may be a  station transmitting at 1020, another at 1010 KHz  and it goes on and on.
So when stations transmit, they try to maximize its signal strength, say  around the 1030 frequency, ,it tries to maximize it there. And then it tries to make sure that the signal strengthdoesn't encroach too much into neighboring bands.So notice that each of these stations  gets a roughly 10 kilohertz band.
So let's say, if I want to listen to WBZ News Radio, then I have to tune my capacitor here such that
the band-pass filter have its passing band focused where I care the most.

So when this is passed through, this band-pass filter will allow the 1030 range to mostly get through, and it will attenuate everything else that's further away but it is not  perfect and so it will let through a little bit of the neighboring bands.  That's why with AM radio you always get some interference from the sides of the two neighboring bands.

Fundamentally, that is a small value. Mostly the  1030 will come through. So this was the filter, the band-pass filter

Notice here that selectivity is important.
What is selectivity? Selectivity has to do with trying to capture the signal in a given range.
In the next video, we will see that the selectivity relates to something that you've seen before.

It will be shown how  a RLC circuit, gives voltage values that are much higher than voltage values that are input. We have to look at  Vc divide by Vi.. If the graph of  Vc divide by Vi against omega  is plotted, we will get a low pass filter.

We can do the maths with  Vc over Vi using the voltage divider relation. We can write the impedance of the capacitor and divide it by the sum of all of the other impedance.

And for the magnitude, we can  simply get the square of the real part plus the square of the
imaginary part square rooted.

You've taken it on faith from me that between these two points the function looks like the graph but that is not true.

Next we need to find out mathematically what happens at resonance. After some mathematical analysis, it can be seen that  V_c  is equal to Q times V_i. If Q is very large,  V_c  is more than V_i.

Next, we look at  RLC circuit with V_r  divided by V_i. We will get  a bandpass filter.


So selectivity, we saw this in the context of radios. Selectivity has to do with how selective my filter is. Recall this is a band pass filter And selectivity says, how sharp is this band? How selective am I?
So one way of figuring out selectivity is to look at this ratio omega 0 by delta 0. Where delta 0 is called the bandwidth, it's measured at the point where the various parts of the curve reaches 1
by square root 2 of its highest value.


So higher omega 0 by delta omega, higher the selectivity. So the reason is that as delta omega becomes narrower, my filter becomes more selective.

For the  next part, we need to find out what is delta omega. Absolute magnitude of  V_r  divided by V_i   is one by square root 2. Eventually we will get a result of delta omega equal to R/L.

As  2 alpha is equal to R divided by L so  omega 0 by delta omega is equal to Q. The lower the R, the sharper the peak, the more selective the filter. So high q implies high selectivity.  From  Q, you can tell all kinds of things about that circuit.

Q can also be defined as 2 pi times the energy stored in the circuit divided by energy lost per cycle in the circuit.


Monday, June 13, 2016

Circuits and Electronics - The Impedance Model (Lecture 20)

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

Lecture Notes:- http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-002-circuits-and-electronics-spring-2007/lecture-notes/

A simpler way to get V_p is explored in this lecture. First divide the numerator and denominator by sC, and what is obtained is something that looks like a voltage divider relationship. 1/sC can be replaced with Z_c  which will make it look more like one.

Next looking at the impedance models of the resistor, capacitor and inductor, we can see how  the impedance is part of Ohm's law where Z_c and Z_L are the impedances  for a capacitor and an inductor. For a drive of the form Vi e raised to st, the complex amplitude, Vc of the response, is related to the complex amplitude Ic algebraically by a generalization of Ohm's Law.

 Looking at the RC circuit, and replacing the capacitor with the impedance model Z_c,  we will see something interesting when finding V_c. We will find that V_c is  the famed complex amplitude V_p that we have been trying to derive except the method now is much simpler. All circuit methods can be used to further analyze the circuit.

 Signal notation is discussed-there are four of them including the complex amplitude notation.

 Here is a summary of the impedance method: -

(1) First step we replace the sinusoidal sources by their complex or real amplitudes.

(2) As a second step, we replace circuit elements by boxes. These boxes are the impedance boxes, or         impedances.

(3) Determine the complex amplitudes of the voltages and currents at the various node points and the       branches.

(4)  The fourth step is not really necessary - obtain the time variables from the complex amplitudes.

 For the series RLC circuit, we have to find out what is V_r.

Next we try to get  the  magnitude of the transfer function  of  V_r/V_i.   To get the frequency response, sketch  the  graph of magnitude  against omega.  The  way to do this is to figure out the asymptotes.  We will need to find out the values of the magnitude for small and high values of omega.  We also need to look at the value of the magnitude where a certain part of the equation goes to zero.



So when omega is very small, what happens? So when omega is very small,  , and similarly,  an omega squared values can be ignored. So what  we are left with  is approximately omega RC.
Now what does omega RC look like?  Of course, at omega equals 0, it will be 0 at first. But for very low values of omega, as we increase it, it begins to go up in a linear manner.


Next, what happens for large values of omega? So when omega is very large, then  1 can be ignored in relation to omega squared LC. So we get approximately  R divided by omega L for very large values of omega.

.
So what happens at that omega equals 1 by square root of LC?   We will get a value of 1.

When we sketch the graph, we will get some kind of bandpass filter which allow signals to pass within a certain band of frequencies.


Sunday, June 5, 2016

Circuits and Electronics - Sinusoidal Steady State (Lecture 19)

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

Lecture Notes:- http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-002-circuits-and-electronics-spring-2007/lecture-notes/


One of the most important reasons why we care about sinusoids is that signals can be
represented as sums of sinusoids. The technique that can transform any wave form into a
sum of sinusoids representation is called Fourier analysis. Fourier series analysis can show that
it can be represented as a sum of sinusoids. Circuits have to be linear for this to happen.
The response of circuits to sinusoids as a function of frequency is called the frequency
response of the circuit. As the input  frequency of the amplifier increases, the amplitude of the output will decrease. Not only that, the phase will also change.

 A very simple circuit example with a sinusoidal input is used - an RC network- a series connection of a resistor and capacitor. This mimics the input of the RC circuit that is part of the amplifier. So the amplifier looks like this- it has a  gate capacitance, CGS. GS, and a the resistor, R. which is  some parasitic resistance of the wires.

The input voltage is  equal to some amplitude VI cosine of omega t, and for t greater than or equal to 0. There will be three ways of approaching the problem - the first being the most difficult - using differential equations. The third being the easiest - almost totally done  by inspection.



So the first step, as is our usual practice, is to set up the differential equation by the node method.
So the current leaving the node in this direction is v minus v_I divided by R. And the current heading down this direction is C dv/dt.  And the currents must sum to 0 by the node method.
So multiply the whole thing, both sides by R, and shuffle things around. So we get RC dv dt. plus v minus v_I equals 0. So what I want to do is move v_I to the right-hand side and write it like this.
And then I've been given that v_I is V_i cosine of omega t.

So now I am ready for the second step, which is to find the particular solution to the sinusoid,  v_P.
This is where things become messy and is not a path to be taken. Instead we will try an exponential input as it gives rise to a nice solution. However we are not sure how this would relate to the answer at the moment.

So for that sneaky input V_i e raised to st let's go back and do our usual thing. We'll try a solution of v_PS ( where s stands for sneaky)  given by V_p e raised to st. We will eventually get a solution where V_p is equal to V_i divided by 1 plus sRC. Replacing s with j omega, v_PS will be V_i divide by 1 plus j omega RC times e raised to j omega t.  V_i divide by 1 plus j omega, RC is the complex amplitude.

Based on Euler Relations, the real part of the sneaky input is equal to the the input, V_i cosine of omega t. Then based on the inverse superposition argument the real output can be found by
taking the real part of the sneaky output. So V_p would be V_i divide by 1 plus j omega RC. But first we will try to work out the magnitude and phase of the complex number expression in the bracket. With sound knowledge of complex numbers, the particular solution can be found.

Next would be to find the homogeneous solution which would be v_H equals A e raised to minus t
divided by RC.

The fourth step would be to find the total solution which would be v_P + v_H. With the initial conditions A can be found.

The particular solution is the sinusoidal steady state which matters more than the transient state. Steps 3 and 4 were not relevant.

A block diagram of the approach is shown and then after that a summary but there is a simpler approach by inspection.

A magnitude plot and a phase plot can be drawn for the output. This is the frequency response.

Finally a summary of  lecture 19 and a preview of what is coming up next.


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

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 .