User Tools

Site Tools


ecen_240_assignments

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
ecen_240_assignments [2016/01/04 13:16]
petersen
ecen_240_assignments [2016/09/07 09:18] (current)
wilde [MT240.NR.0]
Line 32: Line 32:
 | Ch 10     | [[ecen_240_assignments#​MT240.NR.10|MT240.NR.10]] ​        | Sinusoidal Steady-State Power Calc|                                                                                                                             | | Ch 10     | [[ecen_240_assignments#​MT240.NR.10|MT240.NR.10]] ​        | Sinusoidal Steady-State Power Calc|                                                                                                                             |
 | :::       | [[ecen_240_assignments#​MT240.NR.10.4.1|MT240.NR.10.4.1]] | Complex Power                     ​| ​    ​[[matlab_guide#​Annotation| Text]] ​                                                                                      | | :::       | [[ecen_240_assignments#​MT240.NR.10.4.1|MT240.NR.10.4.1]] | Complex Power                     ​| ​    ​[[matlab_guide#​Annotation| Text]] ​                                                                                      |
 +| :::       | [[ecen_240_assignments#​MT240.NR.10.4.2|MT240.NR.10.4.2]] | Complex Power                     ​| ​    ​Review ​                                                                                      |
 | Ch 12     | [[ecen_240_assignments#​MT240.NR.12|MT240.NR.12]] ​        | Intro to L. Transform ​            ​| ​                                                                                                                            | | Ch 12     | [[ecen_240_assignments#​MT240.NR.12|MT240.NR.12]] ​        | Intro to L. Transform ​            ​| ​                                                                                                                            |
 | Ch 13     | [[ecen_240_assignments#​MT240.NR.13|MT240.NR.13]] ​        | L Transform in Circuit Analysis ​  ​| ​                                                                                                                            | | Ch 13     | [[ecen_240_assignments#​MT240.NR.13|MT240.NR.13]] ​        | L Transform in Circuit Analysis ​  ​| ​                                                                                                                            |
Line 45: Line 46:
 Read and follow along with the document to get an introduction to MATLAB. \\  Read and follow along with the document to get an introduction to MATLAB. \\ 
  
-{{:​240matlab:​ch0:​matlab_intro.docx|}} \\ +{{:​240matlab:​ch0:​matlab_intro.pdf|}} \\ 
  
 After completing the document, make sure that you feel comfortable with the following MATLAB topics: After completing the document, make sure that you feel comfortable with the following MATLAB topics:
Line 72: Line 73:
 ===== Resistors In Parallel ===== ===== Resistors In Parallel =====
 ==== MT240.NR.3.2.1 ==== ==== MT240.NR.3.2.1 ====
-== Description ​== +== Document ​== 
-<​file>​ +{{:​240matlab:​ch3:​mt240_nr_3_2_1_parallelresistors.pdf|}}
-   ​MT240_NR_3_2_1_T Parallel Resistors Template +
-   ​Objective:​ learn how to create a function file. +
- +
-   ​Commands:​ function file, sum +
- +
-  Exercise: Create a function file that can accept an array of resistors +
-            that represents resistors in parallel. The function will add them  +
-            together in parallel and return the value. +
-            Verify your function by adding the following resistors in +
-            parallel suing your function. [64,​64,​32,​16,​8] +
-</​file>​ +
- +
-== Template == +
- +
-{{:​240matlab:​ch3:​mt240_nr_3_2_1_t_parallelresistorstemplate.m|}}+
  
 <ifauth @admin,​@240ta>​ <ifauth @admin,​@240ta>​
Line 97: Line 83:
 ===== Voltage Division ===== ===== Voltage Division =====
 ==== MT240.NR.3.4.1 ==== ==== MT240.NR.3.4.1 ====
-==  ​Description ​ == +==  ​Document ​ == 
-<​file>​ +{{:​240matlab:​ch3:​mt240_nr_3_4_1_voltage_division.pdf|}}
-   ​MT240_NR_3_4_1 Voltage Division +
-  Objective: In this activity you will learn how to create function files and use Matlab to  +
-             ​compute voltage division. +
- +
-  Commands: Function File (you will learn to implement the a function file) +
- +
-  Exercise: There are two images associated with this problem. Look on the +
-            wiki page to view them. Voltage division using resistors is a +
-            common technique used to obtain a certain voltage. For example. +
-            suppose you have a 10V voltage source, but you need to connect +
-            a device to 5V. You could use two resistors in series to divide +
-            the 10V in order to get 5V across a resistor. You can then +
-            attach your device in parallel to the resistor that has a 5V +
-            drop across it. However, The moment you attach the device in +
-            parallel to the resistor you notice that the voltage is no +
-            longer 5V. This exercise will help you understand what happens +
-            when you add a load resistor to a circuit that uses voltage +
-            division.  +
-     a) The first step is to reduce the circuit seen in image 1 to look like the circuit in image 2.  +
-        Use the parallel resistor function file created in modulo +
-        MT240.NR.3.2.1 to add the resistors in parallel. You may have to +
-        first add some resistors in series before passing the resistor +
-        values in the function file. +
-     b) Now you should have a simple circuit consisting of a 10V source, +
-        and two equivalent resistors. You connect a potentiomenter (RL) in +
-        parallel with the second equivalent resistor (see image 2), and it +
-        begins to draw current. Plot V2 in terms of RL as you change the +
-        value of RL from 0 to 100 with intervals of 1. RL = 1:100; +
-     c) Questions:​ +
-        1) What two values does V2 asymptotically approach +
-        2) What impact on V2 does RL have? Why?  +
-</​file>​ +
- +
-== Image 1 == +
- +
-{{:​240circuits:​voltagedivision1.png?​400|}} +
- +
-== Image 2 == +
- +
-{{:​240circuits:​voltagedivision2.png?​200|}} +
- +
-== Template == +
-{{:​240matlab:​ch3:​mt240_nr_3_4_1_t_voltagedivisiontemplate.m|}} +
- +
-== Solution Image == +
-{{:​240matlab:​ch3:​mt240_nr_3_4_1_si_voltagedivisionsolutionimage.jpg?400|}}+
  
 <ifauth @admin,​@240ta>​ <ifauth @admin,​@240ta>​
 == Solution == == Solution ==
- +{{:​240matlab:​solutions:​ch3:​mt240_nr_3_4_1_voltage_division.m|}}
-{{:​240matlab:​solutions:​ch3:​mt240_nr_3_4_1_voltagedivision.m|}}+
 </​ifauth>​ </​ifauth>​
  
Line 155: Line 94:
 ===== Node-Voltage w/ Dependent Sources ===== ===== Node-Voltage w/ Dependent Sources =====
 ==== MT240.NR.4.3.1 ==== ==== MT240.NR.4.3.1 ====
-==  ​Description ​ == +==  ​Document ​ ==
-<​file>​ +
-   ​MT240_NR_4_3_1 Node Voltage Method +
- +
-  Objective: Learn how to solve a system of equation using a matrix in +
-             ​MATLAB +
- +
-  Commands: inv +
- +
-  Exercise: In this exercise you will study the effects that resistor R2 +
-            has on the voltage drop Vx. The resistor values of R2 are +
-            R2 = 0:5:30 +
-            a) Using the image provided, set up the system of equation in  +
-               a matrix for every value of R2. See the template for help. +
-            b) Solve for Vx and plot Vx as a function of R2 on a graph. +
-            c) Question: Using the graph, estimate the value of R2 that  +
-               ​causes Vx to have 5V across it.  +
-</​file>​ +
- +
-== Image == +
- +
-{{:​240circuits:​nvm.png?​400|}} +
- +
-== Template == +
- +
-{{:​240matlab:​ch4:​mt240_nr_4_3_1_t_nodevoltagemethodtemplate.m|}} +
- +
-== Solution Image ==+
  
-{{:​240matlab:​ch4:​mt240_nr_4_3_1_si_nodevoltagemethodsolutionimage.jpg?400|}}+{{:​240matlab:​ch4:​mt240_nr_4_3_1_node_voltage_method.pdf|}}
  
 <ifauth @admin,​@240ta>​ <ifauth @admin,​@240ta>​
 == Solution == == Solution ==
  
-{{:​240matlab:​solutions:​ch4:​mt240_nr_4_3_1_nodevoltagemethod.m|}}+{{:​240matlab:​solutions:​ch4:​mt240_nr_4_3_1_node_voltage_method.m|}}
 </​ifauth>​ </​ifauth>​
  
Line 195: Line 107:
 ===== Maximum Power Transfer ===== ===== Maximum Power Transfer =====
 ==== MT240.NR.4.12.1 ==== ==== MT240.NR.4.12.1 ====
-==  ​Description ​ ==+==  ​Document ​ ==
  
-<​file>​ +{{:​240matlab:​ch4:​mt240_nr_4_12_1_max_power_transfer.pdf|}}
-   ​MT240_NR_4_12_1_T Max Power Transfer Template +
- +
-  Objective: Demonstrate the ability to solve for a T-equiv circuit and see how changes in a load +
-             ​resistor affects the power absorbed.  +
- +
-  Exercise: This exercise is to help you visually understand max power +
-            transfer by plotting the voltage, current and power at the +
-            terminals ab (see image provided) as a function of the load +
-            resistance. +
-  a) Reduce the circuit using MATLAB (see image 1) to either its Norton or Thevenin +
-     ​equivalent. To do so, solve for the voltage open circuit (VOC) and current +
-     short circuit (ISC) to find the Thevenin resistance.  +
-  b) Hook the simplified circuit up to an adjustable resistor and calculate +
-     ​current,​ voltage, and power as a function of load resistance. The load +
-     ​resistor RL will have values of 0:1:100.  +
-  c) plot the power, voltage, and current across the load resistor as a +
-     ​function of RL +
-  d) Question: At what value of RL is power the greatest? How does this +
-     ​relate to R Thevenin? +
- +
-</​file>​ +
- +
-== Images == +
- +
-{{:​240circuits:​maxpowertransfer1.png?​600|}} +
- +
-You should be able to reduce the circuit above to look similar to one of the two circuits \\  +
-shown below. RL is the load resistor that you hook up to the circuit across the terminals ab in part b. +
- +
-{{:​240circuits:​maxpowertransfernor.png?​200|}} ​ {{:​240circuits:​maxpowertransferthv.png?​200|}} +
- +
-== Template == +
- +
-{{:​240matlab:​ch4:​mt240_nr_4_12_1_t_maxpowertransfertemplate.m|}} +
- +
-== Solution Image == +
- +
-{{:​240matlab:​ch4:​mt240_nr_4_12_1_si_maxpowertransfersolutionimage.jpg?​400|}} +
- +
-== Solution PDF == +
- +
-{{:​240matlab:​ch4:​mt240_nr_4_12_1_s_maxpowertransfersolution.pdf|}}+
  
 <ifauth @admin,​@240ta>​ <ifauth @admin,​@240ta>​
 == Solution == == Solution ==
  
-{{:​240matlab:​solutions:​ch4:​mt240_nr_4_12_1_maxpowertransfer.m|}}+{{:​240matlab:​solutions:​ch4:​mt240_nr_4_12_1_max_power_transfer.m|}}
 </​ifauth>​ </​ifauth>​
  
Line 250: Line 120:
 ===== Inverting Op-Amp ===== ===== Inverting Op-Amp =====
 ==== MT240.NR.5.3.1 ==== ==== MT240.NR.5.3.1 ====
- +== Documents ​== 
-== Description ​== +{{:​240matlab:​ch5:​mt240_nr_5_3_1_inverting_op_amp.pdf|}} \\ 
-<​file>​ +{{:​240matlab:​ch5:​mt240_nr_5_3_1_inverting_op_amp_function.pdf|}}
- +
- ​MT240_NR_5_3_1 Inverting Op-Amp  +
- +
- ​Background:​ Op-Amps can amplify a signal up to the value of its rails. For  +
-             ​example,​ consider an inverting op-amp with a gain of -10 and rails +
-             of -10V and 10V. If the signal x = 3*cos(2*pi*t) was passed through  +
-             the op-amp, the rails would prevent the output from reaching a +
-             ​magnitude of 30. Instead, the rails would clip it from -10 to +
-             10 and the output signal would resemble a square wave.  +
-  +
- ​Objective:​ Use MATLAB to analyse the feedback current when the op-amp goes +
-            from the linear region into the non-linear region.  +
-            i.e. when clipping occurs. +
- +
- +
- +
- ​Commands:​ if statement , mesh +
- +
- ​Exercise:​ For both parts of this exercise use the image provided and the +
-           ​values indicated below. +
-         +
-           Rs = 1e3; +
-           Rf = 1e3:​1e3:​6e3;​ +
-           Vpos = 20; +
-           Vneg = -20; +
-           Vin = 5*cos(200*pi*t);​ +
- +
- Part 1)  +
-      a) Write a function file that simulates and inverting op-amp and +
-         takes in the parameters Rs, Rf, Vpos,Vneg, and Vin. Ensure that  +
-         the program takes into account clipping. This means that the  +
-         ​output voltage must be within the rails, Vneg <= Vout <= Vpos. +
-         See the template for the inverting op-amp function file for more +
-         ​information.  +
-      c) Use the function from part 1a to plot Vout as a function of time +
-         and Rf using this given t array t = 0:.0001: 2*T-.0001;​ +
-         The Plot will require a 3D plot. Use the mesh command +
-      d) Question: What value of Rf causes the output signal to clip? +
-  +
- Part 2) Change the input signal to 5V; Note that it is DC. Also, change the +
-         ​values of Rf, and calculate Vout. +
- +
-         Rf = 1e3:​100:​5e3;​ +
-         Vin = 5; +
- +
-         Use the calculate Vout to find the feedback current '​If'​ (see image)  +
-         a function of Rf. Be sure to capture the behaviour of If in the  +
-         ​linear and non-linear region.  +
-      a) Plot the results. '​If'​ vs Rf. +
-      b) Questions:​ +
-         1) Estimate the value of Rf when '​If'​ began to decrease. +
-         2) Why does '​If'​ begin to decrease? +
- +
- +
-</​file>​ +
- +
-== Image == +
- +
-{{:​240circuits:​invertingopamp.png?​300|}} +
- +
-== Template == +
- +
-{{:​240matlab:​ch5:​mt240_nr_5_3_1_t_inverting_opampfunctionfiletemplate.m|}} +
- +
-{{:​240matlab:​ch5:​mt240_nr_5_3_1_t_inverting_opamptemplate.m|}} +
- +
-== Solution Image == +
- +
-{{:​240matlab:​ch5:​mt240_nr_5_3_1_si1_inverting_opampsolutionimage1.jpg?​400|}} +
- +
-{{:​240matlab:​ch5:​mt240_nr_5_3_1_si2_inverting_opampsolutionimage2.jpg?400|}}+
  
 <ifauth @admin,​@240ta>​ <ifauth @admin,​@240ta>​
 == Solution == == Solution ==
 +{{:​240matlab:​solutions:​ch5:​mt240_nr_5_3_1_inverting_op_amp.m|}} \\
 +{{:​240matlab:​solutions:​ch5:​mt240_nr_5_3_1_inverting_op_amp_function.m|}}
  
-{{:​240matlab:​solutions:​ch5:​mt240_nr_5_3_1_inverting_opampfunctionfile.m|}} 
- 
-{{:​240matlab:​solutions:​ch5:​mt240_nr_5_3_1_inverting_opamp.m|}} 
 </​ifauth>​ </​ifauth>​
  
Line 337: Line 135:
 ==== MT240.NR.5.4.1 ==== ==== MT240.NR.5.4.1 ====
  
-== Description ​==  +== Documents ​== 
-<file >+
  
- ​MT240_NR_5_4_1 Summing Amplifier  +{{:​240matlab:​ch5:​mt240_nr_5_4_1_sum_op_amp.pdf|}} \\ 
- +{{:​240matlab:​ch5:​mt240_nr_5_4_1_sum_op_amp_function.pdf|}}
- ​Objective:​ Use MATLAB to simulate a summing operational amplifier to gain +
- a visual understanding of adding multiple signals together.  +
-  +
- ​Commands:​ subplot +
-  +
- ​Exercise:​  +
-    a) create a function file that simulates a summing op-amp. +
-       This function will simulate a summing op-amp with an arbitrary number of +
-       input voltage sources, a input resistance for every voltage source, one +
-       feed back resistance, a positive voltage rail, and a negative voltage +
-       rail. The function will return the output voltage. +
- +
-         The function will be passed five parameters: Vs, Rs, Rf, Vpos, Vneg. +
-         Vs represents the input voltages. see below for more detail +
-         Rs is an array of source resistance +
-         Rf is the feedback resistance +
-         Vpos is the positive voltage rail +
-         Vneg is the negative voltage rail +
-         +
-         Rs is an array [R1 R2 ... Rn]         +
-         Rs = [2e3 2e3 2e3]; +
-         Rf = 3e3; +
-         Vpos = 20; +
-         Vneg = -20; +
- +
-         Vs is a matrix with the columns representing V1, V2, ...Vn and the rows +
-         ​representing the values. If each input voltage was DC than there would +
-         only be one row. Rs is an array containing the input resistance of each +
-         input voltage. Vpos and Vneg represent the rails. +
- +
-        Vs is a matrix that looks like +
-           ​V1 ​   V2        Vn       +
-         | V1(1) V2(1) ... Vn(1) | +
-         | V1(2) V2(2) ... Vn(2) | +
-         ​| ​  : ​    : ​        : ​  | +
-         | V1(n) V2(n) ... Vn(n) | +
-         +
-         V1 = 4/​pi*sin(2*pi*t);​ +
-         V2 = 4/​(3*pi)*sin(6*pi*t);​ +
-         V3 = 4/​(5*pi)*sin(10*pi*t);​ +
-         Vs = [V1' V2' V3'​];​ +
- +
-         +
-        See the Template for more information.  +
-         +
-    b) Using the image provided, calculate Vout as  +
-       a function of time. The time array (t) should be  +
-      (2 times the max period of the three frequencies) +
- +
-         T = 1;                             this is the max period +
-         ​time_begin = 0;                     the beginning of the time array +
-         ​time_step = 0.0001; ​                the time step +
-         ​time_end = 2*T-time_step; ​          the ending time +
-         t = time_begin:​time_step:​time_end; ​ array that represents time +
- +
-    c) On the same figure and using the subplot command, plot all three +
-       input signals and Vout.  +
-    d) Question:  +
-           What type of a wave does Vout resemble?  +
-    e) Calculate Vout with the following input voltage sources +
- +
-         V1 = 4/​pi*sin(2*pi*t);​ +
-         V2 = 4/​(3*pi)*sin(6*pi*t);​ +
-         V3 = 4/​(5*pi)*sin(10*pi*t);​ +
-         V4 = 4/​(7*pi)*sin(14*pi*t);​ +
-         V5 = 4/​(9*pi)*sin(18*pi*t);​ +
-         V6 = 4/​(11*pi)*sin(22*pi*t);​ +
-         V7 = 4/​(13*pi)*sin(26*pi*t);​ +
-         V8 = 4/​(15*pi)*sin(30*pi*t);​ +
-         V9 = 4/​(17*pi)*sin(34*pi*t);​ +
-         V10 = 4/​(19*pi)*sin(38*pi*t);​ +
-         +
-         Let the input resistance (Rs) for each input voltage source be +
-         2e3. Also, use the same time array you used in part b. +
-     f) Plot Vout obtained from part e as a function of time on a separate +
-        figure. +
-     g) Question: +
-           What impact does adding more input voltage sources have on Vout? +
- +
-</​file>​  +
- +
-== Image == +
- +
-{{:​240circuits:​summingopamp.png?​400|}} +
- +
-== Template == +
- +
-{{:​240matlab:​ch5:​mt240_nr_5_4_1_t_sum_opampfunctionfiletemplate.m|}} +
- +
-{{:​240matlab:​ch5:​mt240_nr_5_4_1_t_sum_opamptemplate.m|}} +
- +
-== Solution Image == +
- +
-{{:​240matlab:​ch5:​mt240_nr_5_4_1_si1_sum_opampsolutionimage1.jpg?​400|}} +
- +
-{{:​240matlab:​ch5:​mt240_nr_5_4_1_si2_sum_opampsolutionimage2.jpg?400|}}+
  
 <ifauth @admin,​@240ta>​ <ifauth @admin,​@240ta>​
 == Solution == == Solution ==
  
-{{:​240matlab:​solutions:​ch5:​mt240_nr_5_4_1_sum_opampfunctionfile.m|}} +{{:​240matlab:​solutions:​ch5:​mt240_nr_5_4_1_sum_op_amp.m|}} \\ 
- +{{:​240matlab:​solutions:​ch5:​mt240_nr_5_4_1_sum_op_amp_function.m|}}
-{{:​240matlab:​solutions:​ch5:​mt240_nr_5_4_1_sum_opamp.m|}}+
 </​ifauth>​ </​ifauth>​
  
Line 465: Line 165:
 ==== MT240.NR.6.2.1 ==== ==== MT240.NR.6.2.1 ====
  
-== Description ​== +== Document ​== 
- +{{:​240matlab:​ch6:​mt240_nr_6_3_1_capacitor.pdf|}}
-<​file>​ +
- ​MT240_NR_6_3_1 Capacitor +
- +
- ​Objective:​ Understand the relationship between current, voltage, power +
- and energy in a capacitor.  +
- +
- ​Exercise:​ A Capacitor of 5F with an initial voltage of 5V is attached to +
-           a current source. The behavior of the current source is given  +
-           to you below.  +
-           a) Calculate the voltage across the capacitor. You will need to +
-              use a for loop to approximate an integral. +
-           b) Calculate the power stored in the capacitor. +
-           c) Calculate the energy stored in the capacitor. +
-           d) Plot Voltage, Power, and Energy in the capacitor as a  +
-              function of time. +
-           e) Approximate at what point in time the energy is zero in the  +
-              capacitor?​ +
- +
- +
- this for-loop generates an array that represents current as a function of +
- time. The time array is also given. +
- +
- ​creates an array of length 56 +
- I = zeros(1,​71);​ +
- t = 0:​length(I)-1; ​ time  +
- for m = 1:​length(I) +
- if m < 10 +
- I(m) = 0; +
- elseif m < 20 +
- I(m) = -5 +.5*m; +
- elseif m < 25 +
- I(m) = -15+m; +
- elseif m < 35 +
- I(m) = 10; +
- elseif m < 40 +
- I(m) = 115-3*m; +
- elseif m < 45         +
- I(m) = 75-2*m; +
- elseif m < 55 +
- I(m) = -15; +
- elseif m < 70 +
- I(m) = -70+m; +
- else +
- I(m) = 0; +
- end +
- end +
-</​file>​ +
- +
-== Template == +
- +
-{{:​240matlab:​ch6:​mt240_nr_6_3_1_t_capacitortemplate.m|}} +
- +
-== Solution Image === +
- +
-{{:​240matlab:​ch6:​mt240_nr_6_3_1_si_capacitorsolutionimage.jpg?400|}}+
  
 <ifauth @admin,​@240ta>​ <ifauth @admin,​@240ta>​
 == Solution == == Solution ==
 +{{:​240matlab:​solutions:​ch6:​mt240_nr_6_3_1_capacitor.m|}}
  
-{{:​240matlab:​solutions:​ch6:​mt240_nr_6_3_1_capacitor.m|}} 
 </​ifauth>​ </​ifauth>​
  
Line 532: Line 177:
 === MT240.NR.7.2.1 === === MT240.NR.7.2.1 ===
  
-== Description ​==+== Document ​==
  
-<​file>​ +{{:​240matlab:​ch7:​mt240_nr_7_2_1_nat_tesp_rc_circuit.pdf|}}
-  MT240_NR_7_2_1 Natural Response of RC Circuit +
- +
- ​Objective:​ Gain a visual understanding of how resistors affect the rate a +
- ​capacitor dissipates energy by analysing the voltage across the +
- ​capacitor as a function of time and tau.  +
- +
- ​Exercise:​ You have several 20mF capacitors with an initial voltage of 20V. +
-           You design circuits composing of one capacitor and one +
-           ​resistor. Every resistor has a different value, and the +
-           ​resistor values range from  +
- +
-               R = 1e3:​1e3:​10e3  +
- +
-           The resistor and capacitor are connected together at t = 0. +
-           ​Analyse the voltage across every capacitor as a function of +
-           ​time. +
- +
-               C = 20e-3; ​ the value of the capacitor +
-               Vinit = 20;  initial voltage across the capacitor at t = +
-               0s +
- +
- +
- +
-        a) Calculate the various values of tau for every RC circuit. +
-           tau = R*C. +
- +
-           tau = INSERT CODE HERE +
- +
-        b) Create the time array to use for every circuit. The duration of  +
-           time must be >= 5*tau of the largest tau. +
- +
-             the largest tau is from the largest resistor. +
-             ​time_beg = 0; +
-             ​time_step = 10; +
-             ​time_end = 5*tau(?); index you tau array +
-             t = time_beg:​time_step:​time_end;​ an array of time +
- +
-       c) Calculate the voltage across the capacitors as a function of +
-          time. +
- +
-          V(t) = Vinit*exp(INSERT CODE HERE); +
-  +
- +
-       d) Calculate the voltage across the capacitor as a function of tau; +
- +
-           t_tau = 0:​0.1:​5; ​ array of tau +
-           ​V(tau) = Vinit*exp(-t_tau);​ +
- +
-       e) Create two plots: one with the voltage as a function of time and the other  +
-          with voltage as a function of tau. +
-       f) Questions:​ +
-            1) How does resistance affect the rate at which a capacitor +
-               ​discharges?​ +
-            2) Why are the plots the same when going by tau? +
- +
-</​file>​ +
- +
-== Template == +
- +
-{{:​240matlab:​ch7:​mt240_nr_7_2_1_t_nat_resp_rc_circuittemplate.m|}} +
- +
-== Solution Image == +
- +
-{{:​240matlab:​ch7:​mt240_nr_7_2_1_si1_nat_resp_rc_circuitsolutionimage1.jpg?​400|}} +
- +
-{{:​240matlab:​ch7:​mt240_nr_7_2_1_si2_nat_resp_rc_circuitsolutionimage2.jpg?400|}}+
  
 <ifauth @admin,​@240ta>​ <ifauth @admin,​@240ta>​
 == Solution == == Solution ==
 +{{:​240matlab:​solutions:​ch7:​mt240_nr_7_2_1_nat_tesp_rc_circuit.m|}}
  
-{{:​240matlab:​solutions:​ch7:​mt240_nr_7_2_1_nat_resp_rc_circuit.m|}} 
 </​ifauth>​ </​ifauth>​
  
Line 611: Line 190:
 ==== MT240.NR.8.2.1 ==== ==== MT240.NR.8.2.1 ====
  
-== Description == +== Document ​==
- +
-<​file>​ +
- ​MT240_NR_8_2_1 RLC Circuit +
- +
- ​Objective:​ Gain a visual understanding of how the resistance in an RLC +
- ​circuit can affect the circuit'​s response.  +
- +
- ​Commands:​ roots, real, imag  +
- +
- ​Background:​ So far you have explored specific solutions to the three RLC +
- ​cases:​ underdamped,​ overdamped, and critically damped. In this program +
- you will explore the general solution of a parallel RLC circuit that generates +
- all three cases. Your book introduces the general solution in section 8-1,  +
- and we will use it to derive the necessary equation. +
- The goal is to create the general solution as shown below. +
- X(t) = A1*exp(s1*t) + A2*exp(s2*t) +
- +
- Below I will explain how to derive the general solution +
- The second order differential equation for a parallel RLC circuit is +
- ​d^2i/​dt + (1/RC)di/dt + I/LC = 0.  +
- This equation is transformed into the characteristic equation. +
- s^2 + (1/RC)*S + 1/LC = 0 +
- ​Notice how the equation is a second order polynomial that can be solved. +
- By solving for the roots of the characteristic equation you obtain s1, and +
- s2.  +
- With s1 and s2 known, you can set up a system of equations to solve for +
- A1 and A2. +
- ​X_init = A1*exp(s1*0) + A2*exp(s2*0) +
- dx/dt = A1*s1*exp(s1*0) + A2*s2*exp(s2*0) +
- Now that A1, A2, s1, and s2 are found, you can generate the general +
- ​solution. +
- X(t) = A1*exp(s1*t) + A2*exp(s2*t) +
- +
- ​Exercise:​ You have a parallel RLC circuit as shown in the image below. +
- The current source has a value of 3A, the capacitor 100uF, the inductor +
- 4H, and a potentionmeter (R) assumes the values R = 70:​200:​1070. Assume +
- that the switch has been closed for a long time before opening it at t = +
- 0s. +
- a) Calculate the general solution to the RLC circuit for every resistor. +
-    There should be 6 resistor values. +
- b) Plot the current through the inductor as a function of time for all +
-    values of R. +
- c) What happens as resistance increases? And why? +
-</​file>​ +
- +
-== Image == +
- +
-{{:​240circuits:​underdamped.png?​400|}} +
- +
-== Template == +
- +
-{{:​240matlab:​ch8:​mt240_nr_8_2_1_t_rlccircuittemplate.m|}} +
- +
-== Solution Image ==+
  
-{{:​240matlab:​ch8:​mt240_nr_8_2_1_si_rlccircuitsolutionimage.jpg?400|}}+{{:​240matlab:​ch8:​mt240_nr_8_2_1_rlc_circuit.pdf|}}
  
 <ifauth @admin,​@240ta>​ <ifauth @admin,​@240ta>​
 == Solution == == Solution ==
- +{{:​240matlab:​solutions:​ch8:​mt240_nr_8_2_1_rlc_circuit.m|}}
-{{:​240matlab:​solutions:​ch8:​mt240_nr_8_2_1_rlccircuit.m|}}+
 </​ifauth>​ </​ifauth>​
  
Line 678: Line 202:
 ==== MT240.NR.9.1.1 ==== ==== MT240.NR.9.1.1 ====
  
-<​file>​ +== Document ​== 
-   ​MT240_NR_9_1_1 Sinusoid Source +{{:​240matlab:​ch9:​mt240_nr_9_1_1_sinusoidal_source.pdf|}}
- +
-  Objective: Gain a visual understanding of how fast a capacitor can +
-  discharge and charge for a given tau. Also, learn how to identify the +
-  voltage waveform of a capacitor. +
- +
-  Background: It is possible to model a sinusoidal source using a DC source +
-  if the DC source is connected to a toggling switch that turns on and off. +
-  In this exercise you will model a sinusoidal source using a DC source.  +
- +
-  Exercise: You have a circuit as described in the image below. The switch +
-  toggles between position a and position b. At t 0 there is no energy +
-  stored in the capacitor and the switch is in position a. At t 2*tau +
-  the switch moves to position b and so on as indicated in the table.  +
-  Note that at each switch even time starts over at t 0. +
-  | time       | position |  +
-  | t 0      |     ​a ​   | +
-  | t = 2*tau  |     ​b ​   | +
-  | t = 2*tau  |     ​a ​   | +
-  | t = 4*tau  |     ​b ​   | +
-  | t = tau/4  |     ​a ​   | +
-  | t = 4*tau  |     ​b ​   | +
-  | t = tau/6  |     ​a ​   | +
-  | t = 2*tau  |     ​b ​   | +
-  | t = tau/10 |     ​a ​   | +
-  | t = 4*tau  |    end   | End the simulation +
- +
-  a) calculate the voltage as a function of time +
-  b) plot the voltage as a function of time with time being in ms +
-  c) How would you create a waveform that closely approximates a triangle? +
-     In other words, how fast must the switch toggle between position a and +
-     ​b? ​  +
- +
-</​file>​ +
-== Image == +
- +
-{{:​240circuits:​hw10.png?​400|}} +
- +
-== Template == +
- +
-{{:​240matlab:​ch9:​mt240_nr_9_1_1_t_sinusoidalsourcetemplate.m|}} +
- +
-== Solution Image == +
- +
-{{:​240matlab:​ch9:​mt240_nr_9_1_1_si_sinusoidalsourcesolutionimage.jpg?400|}}+
  
 <ifauth @admin,​@240ta>​ <ifauth @admin,​@240ta>​
 == Solution == == Solution ==
  
-{{:​240matlab:​solutions:​ch9:​mt240_nr_9_1_1_sinusoidalsource.m|}}+{{:​240matlab:​solutions:​ch9:​mt240_nr_9_1_1_sinusoidal_source.m|}}
 </​ifauth>​ </​ifauth>​
  
 ===== Z-Circuit Analysis with Mesh Current Method ===== ===== Z-Circuit Analysis with Mesh Current Method =====
 ==== MT240.NR.9.9.1 ==== ==== MT240.NR.9.9.1 ====
- +== Document ​== 
-<​file>​ +{{:​240matlab:​ch9:​mt240_9_9_1_mesh_current_method.pdf|}}
- ​MT240_9_9_1 Mesh_Current Method +
- +
- ​Objective:​ Design a circuit using capacitors and resistors that cause +
- Vout to be 180 degrees out of phase with Vin. +
- +
- ​Background:​ Oscillators can be constructed from op-amps and an RC network. +
- The basic theory is to create a 180 degree phase shift between Vin and +
- Vout. This will cuase the op-amp to continuously oscillate in attempt to +
- make both inputs the same voltage level (virtual short). +
- +
- ​Exercise:​ Refer to the provided image for this problem.  +
- You want to design a circuit that will oscillate at 40e3 Hz. You only +
- have one resistor value (R 1e3 ohms), but you have the various +
- ​capacitors available (C 1e-9:​1e-10:​20e-9). You decide to write a +
- ​program to calculate the angle of Vout in reference to Vin as a function of +
- ​Capacitance. To simplify calculations,​ you decide that every resistor +
- must have the same value and every capacitor must have the same value. +
- Also, since you are only interested in the phase shift of Vout, assume +
- Vin to have a value of 1AC +
- +
-                 ​%Variables +
-                 ​C ​1e-9:​1e-10:​20e-9;​ +
-                 ​R ​1e3; +
-                 w = 2*pi*40000;​ +
-                 ZC = 1./​(1j*w*C);​ +
-                 Vin = 1; +
-                 ic = zeros(1,​length(ZC)); ​ allocate space +
-                 +
-          a) Label the currents in each mesh from left to right ia,ib, and ic. +
-              Use mesh current method to write a system of equations. +
- +
-                 ​System of Equations +
-                 Vin = ia(...) + ib(...) + ic(...) +
-                 ​0 ​  = ia(...) + ib(...) + ic(...) +
-                 ​0 ​  = ia(...) + ib(...) + ic(...) +
-                 +
-              Put the system of equations into matrix form. +
- +
-                                   ​Matrices +
-                              Impedances ​           Currents ​    A +
-                    | (...)    (...)    (...)    | * | ia | = | Vin | +
-                    | (...)    (...)    (...)    | * | ib | = |  0  | +
-                    | (...)    (...)    (...)    | * | ic | = |  0  | +
- +
- +
-           b) Solve for ic for every capacitor value. Remember that all +
-              three capacitors will have the same value. This means that +
-              you should have 191 different values of ic. +
- +
-                  %Solve for Currents: ia, ib, ic +
-                 for m = 1:​length(C) +
-                 ​Impedances = [INSERT CODE HERE]; +
-                 A = [Vin;​0;​0];​ +
-                 ​Currents = INSERT CODE HERE; +
-                 ic(m) = Currents(3);​ +
-                 end +
- +
-           c) Calculate Vout for every value of ic. +
-           d) Calculate the phase shift of Vout in Reference to Vin.  +
-           e) Plot the phase shift as a function of capacitance +
-           f) Question: Approximate the capacitor value that would create +
-              a phase shift of 180 degrees.  +
-</​file>​ +
- +
-== Image == +
- +
-{{:​240circuits:​mt240_nr_9_9_1_mcmcomplex.png?​300|}} +
- +
-== Template == +
- +
-{{:​240matlab:​ch9:​mt240_9_9_1_t_meshcurrentmethodtemplate.m|}} +
- +
-== Solution Image == +
- +
-{{:​240matlab:​ch9:​mt240_9_9_1_si_meshcurrentmethodsolutionimage.jpg?400|}}+
  
 <ifauth @admin,​@240ta>​ <ifauth @admin,​@240ta>​
 == Solution == == Solution ==
 +{{:​240matlab:​solutions:​ch9:​mt240_9_9_1_mesh_current_method.m|}}
 +</​ifauth>​
  
-{{:​240matlab:​solutions:​ch9:​mt240_9_9_1_meshcurrentmethod.m|}} +<​ifauth ​@admin,​@240ta>
-</ifauth>+
  
 ===== Complex Power ===== ===== Complex Power =====
Line 876: Line 282:
 {{:​240matlab:​ch10:​mt240_10_4_1_si2_complexpowersolutionimage2.jpg?​400|}} {{:​240matlab:​ch10:​mt240_10_4_1_si2_complexpowersolutionimage2.jpg?​400|}}
  
-<ifauth @admin,​@240ta>​+
 == Solution == == Solution ==
  
Line 882: Line 288:
 </​ifauth>​ </​ifauth>​
  
-===== Passive Filters ​===== +===== Complex Power ===== 
-==== MT240.NR.14.4.====+==== MT240.NR.10.4.==== 
 +{{:​240matlab:​ch10:​mt240_10_4_2_complex_power.pdf|}}
  
-<​file>​ 
-   ​MT240_14_4_1 Cross over network 
  
-  Objective: Gain an understanding how you can use matlab to help you +<ifauth @admin,​@240ta>​ 
-  ​design lowpass, bandpass, and highpass filters.+== Solution ==
  
-  functions to learnlog10, semilogx+{{:240matlab:​solutions:​ch10:​mt240_10_4_2_complex_power.m|}} 
 +</​ifauth>​
  
-  Introduction:​ A crossover network consists of a highpass, lowpass, and 
-  bandpass filter. They are often used in stereo systems that separates 
-  a signal into three signals (bass, treble, and midrange). You will design 
-  a basic crossover network as depicted in the image below. ​ 
  
-  Exercise: Design a crossover network with the following specifications:​ +===== Passive Filters ===== 
-  |                        | Low pass | Bandpass | High pass | +==== MT240.NR.14.4.1 ​====
-  |Lower cut off frequency | N/A      |  250Hz   | 2000Hz ​   | +
-  |Upper cut off frequency | 250Hz    |  2000Hz ​ | N/A       |  +
-  a) For each filter design you will be calculating the transfer function +
-     of the voltage across each resistor. The equations should be simple  +
-     ​voltage division as shown in the book. See chapter 14. Design your  +
-     ​circuits choosing appropriate values for the capacitors and inductors. +
-  b) Find the magnitudes (|H(jw)|) for v1, v2, and v3 as a function of '​w'​ +
-    (frequency) with w being w 0:​10*2*pi:​3e5*2*pi. Note that this is the  +
-     ​transfer function (H(jw) ​vout/vin) thus the amplitude of the input voltage +
-     ​source isn't needed in your calculations. +
-    1) The midrange is a little more difficult so I provided you with the +
-       ​steps. +
-       a) Calculate the bandwidth. B upper corner frequency - lower fc +
-       b) Solve for the inductor using the relationship B R/L +
-       c) Solve for the capacitor value. +
-  c) Plot the magnitude in decibels vs the frequency(Hz) using a +
-     ​logarithmic scale. (use semilogx for this). +
-  d) How could you design a bandreject filter that rejects frequencies +
-     ​between 250Hz and 2000Hz? +
-</​file>​ +
-== Image == +
- +
-{{:​240circuits:​hw13.png?​400|}} +
- +
-== Template ​== +
- +
-{{:​240matlab:​ch14:​mt240_14_4_1_t_crossover_networktemplate.m|}} +
- +
-== Solution Image ==+
  
-{{:​240matlab:​ch14:​mt240_14_4_1_si_crossover_networksolutionimage.jpg?400|}}+== Document == 
 +{{:​240matlab:​ch14:​mt240_14_4_1_crossover_network.pdf|}}
  
 <ifauth @admin,​@240ta>​ <ifauth @admin,​@240ta>​
ecen_240_assignments.1451938566.txt.gz · Last modified: 2016/01/04 13:16 by petersen