Class #16: Experiment Matlab and Data Analysis

Similar documents
Class #7: Experiment L & C Circuits: Filters and Energy Revisited

Real Analog - Circuits 1 Chapter 11: Lab Projects

Class #8: Experiment Diodes Part I

Integrators, differentiators, and simple filters

Class #3: Experiment Signals, Instrumentation, and Basic Circuits

EK307 Active Filters and Steady State Frequency Response

FREQUENCY RESPONSE AND PASSIVE FILTERS LABORATORY

Class #9: Experiment Diodes Part II: LEDs

ECE 3155 Experiment I AC Circuits and Bode Plots Rev. lpt jan 2013

Bode plot, named after Hendrik Wade Bode, is usually a combination of a Bode magnitude plot and Bode phase plot:

Frequency Selective Circuits

Laboratory 4: Amplification, Impedance, and Frequency Response

, answer the next six questions.

Class #3: Experiment Signals, Instrumentation, and Basic Circuits

Experiment P45: LRC Circuit (Power Amplifier, Voltage Sensor)

Lab 13 AC Circuit Measurements

EE 2274 RC and Op Amp Circuit Completed Prior to Coming to Lab. Prelab Part I: RC Circuit

Experiment 8: An AC Circuit

Electronics and Instrumentation ENGR-4300 Spring 2004 Section Experiment 5 Introduction to AC Steady State

Diodes. Sections

v(t) = V p sin(2π ft +φ) = V p cos(2π ft +φ + π 2 )

PHYSICS 330 LAB Operational Amplifier Frequency Response

Laboratory 7: Active Filters

Chapter 1: DC circuit basics

Experiment Guide: RC/RLC Filters and LabVIEW

Chapter 1: DC circuit basics

EK307 Passive Filters and Steady State Frequency Response

Lab E5: Filters and Complex Impedance

Open Loop Frequency Response

EE-2302 Passive Filters and Frequency Response

AC CURRENTS, VOLTAGES, FILTERS, and RESONANCE

Lab 9 Frequency Domain

Voltage Current and Resistance II

Lab 1: Basic RL and RC DC Circuits

EE 241 Experiment #7: NETWORK THEOREMS, LINEARITY, AND THE RESPONSE OF 1 ST ORDER RC CIRCUITS 1

LAB I. INTRODUCTION TO LAB EQUIPMENT

Name Date: Course number: MAKE SURE TA & TI STAMPS EVERY PAGE BEFORE YOU START EXPERIMENT 10. Electronic Circuits

DC and AC Circuits. Objective. Theory. 1. Direct Current (DC) R-C Circuit

Kent Bertilsson Muhammad Amir Yousaf

ET 304A Laboratory Tutorial-Circuitmaker For Transient and Frequency Analysis

EE 233 Circuit Theory Lab 3: First-Order Filters

4 Experiment 4: DC Motor Voltage to Speed Transfer Function Estimation by Step Response and Frequency Response (Part 2)

BME 3512 Bioelectronics Laboratory Two - Passive Filters

Lab #2 First Order RC Circuits Week of 27 January 2015

Physics 132 Quiz # 23

Lab 3: RC Circuits. Construct circuit 2 in EveryCircuit. Set values for the capacitor and resistor to match those in figure 2 and set the frequency to

An Introductory Guide to Circuit Simulation using NI Multisim 12

ECE 2274 MOSFET Voltmeter. Richard Cooper

Figure E2-1 The complete circuit showing the oscilloscope and Bode plotter.

When you have completed this exercise, you will be able to determine the frequency response of a

LABORATORY 3: Transient circuits, RC, RL step responses, 2 nd Order Circuits

EXPERIMENT 14 Variable-frequency networks

MTE 360 Automatic Control Systems University of Waterloo, Department of Mechanical & Mechatronics Engineering

EE 210: CIRCUITS AND DEVICES

Laboratory 5: RC Circuits and Filtering

E84 Lab 3: Transistor

UNIVERSITY OF NORTH CAROLINA AT CHARLOTTE Department of Electrical and Computer Engineering

EECS 216 Winter 2008 Lab 2: FM Detector Part I: Intro & Pre-lab Assignment

Study of Analog Phase-Locked Loop (APLL)

EE 368 Electronics Lab. Experiment 10 Operational Amplifier Applications (2)

Each individual is to report on the design, simulations, construction, and testing according to the reporting guidelines attached.

EK 307 Lab: Light-Emitting Diodes. In-lab Assignment (Complete Level 1 and additionally level 2 if you choose to):

Sinusoids and Phasors (Chapter 9 - Lecture #1) Dr. Shahrel A. Suandi Room 2.20, PPKEE

PHYS 235: Homework Problems

Pre-Lab. Introduction

ECE 6416 Low-Noise Electronics Orientation Experiment

The object of this experiment is to become familiar with the instruments used in the low noise laboratory.

LAB II. INTRODUCTION TO LAB EQUIPMENT

PHYS 3152 Methods of Experimental Physics I E2. Diodes and Transistors 1

Laboratory Exercise 6 THE OSCILLOSCOPE

Experiment 9 AC Circuits

Activity P52: LRC Circuit (Voltage Sensor)

LAB 8: Activity P52: LRC Circuit

SINUSOIDS February 4, ELEC-281 Network Theory II Wentworth Institute of Technology. Bradford Powers Ryan Ferguson Richard Lupa Benjamin Wolf

Curve Tracer Laboratory Assistant Using the Analog Discovery Module as A Curve Tracer

Experiment #1: Solid State Diodes Testing & Characterization. Type Value Symbol Name Multisim Part Description Resistor 1MΩ R 2 Basic/Resistor ---

LABORATORY 4. Palomar College ENGR210 Spring 2017 ASSIGNED: 3/21/17

UNIVERSITY OF UTAH ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT

Experiment P49: Transistor Lab 2 Current Gain: The NPN Emitter-Follower Amplifier (Power Amplifier, Voltage Sensor)

Advanced Circuits Topics Part 2 by Dr. Colton (Fall 2017)

Boise State University Department of Electrical and Computer Engineering ECE 212L Circuit Analysis and Design Lab

ELEG 205 Analog Circuits Laboratory Manual Fall 2016

ME 365 EXPERIMENT 7 SIGNAL CONDITIONING AND LOADING

Experiment 3. Ohm s Law. Become familiar with the use of a digital voltmeter and a digital ammeter to measure DC voltage and current.

LLS - Introduction to Equipment

Class #6: Experiment The 555-Timer & Pulse Width Modulation

Experiment 2. Ohm s Law. Become familiar with the use of a digital voltmeter and a digital ammeter to measure DC voltage and current.

Fig. 1. NI Elvis System

Unit 4: Principles of Electrical and Electronic Engineering. LO1: Understand fundamental electrical principles Maximum power transfer

Experiment 2: Transients and Oscillations in RLC Circuits

Lab 6: MOSFET AMPLIFIER

LAB 4 : FET AMPLIFIERS

ECE 2201 PRELAB 6 BJT COMMON EMITTER (CE) AMPLIFIER

Experiment 2 Determining the Capacitive Reactance of a Capacitor in an AC Circuit

Using Voltage Dividers to Design a Photo-Sensitive LED Circuit. ( Doug Oliver & Jackie Kane. May be reproduced for non-profit classroom use.

ECE 4670 Spring 2014 Lab 1 Linear System Characteristics

INTRODUCTION TO ENGINEERING AND LABORATORY EXPERIENCE Spring, 2015

ET1210: Module 5 Inductance and Resonance

EXPERIMENT 4: RC, RL and RD CIRCUITs

Lecture 2 Analog circuits. Seeing the light..

Transcription:

Class #16: Experiment Matlab and Data Analysis Purpose: The objective of this experiment is to add to our Matlab skill set so that data can be easily plotted and analyzed with simple tools. Background: Before doing this experiment, students should be able to Analyze simple circuits consisting of combinations of resistors, especially voltage dividers. Do a transient (time dependent) simulation of circuits using LTspice Determine and validate mathematical expressions for steady-state sine and cosine voltage and current waves including amplitude, frequency and phase. Determine complex impedance for R, L and C Analyze RC and RL circuits using phasor analysis and approaches applicable to standard voltage dividers. Convert phasor voltages and currents back to time dependent forms. Perform basic mathematical operations with Matlab Plot basic functions (e.g. sinusoidal, exponential, polynomials) using Matlab Review the background for the previous experiments. Learning Outcomes: Students will be able to Plot experimental or simulated data with Matlab Generate diode I-V plots for signal diodes and LEDs Plot load lines on diode I-V plots and solve for the operating point Resources Required: LTspice Matlab with activation for RPI students Analog Discovery and Parts Kit Helpful links for this experiment can be found on the course website under Class #16. Pre-Lab Required Reading: Before beginning the lab, at least one team member must read over and be generally acquainted with this document and the other required reading materials. Hand-Drawn Circuit Diagrams: Before beginning the lab, hand-drawn circuit diagrams must be prepared for all circuits either to be analyzed using LTspice or physically built and characterized using Analog Discovery. Due: At the beginning of Class #18 K. A. Connor, - 1 - Revised: 26 October 2015

Part A Diode I-V Curves in Matlab Before beginning this experiment, review your work on experiments 5 and 9 on diodes. In experiments 8 and 9 (Diodes Part 1 and 2), you measured the response of the series combination of a resistor and a diode driven by the Analog Discovery function generator. In Exp 8, you should have saved a csv file with information on diode voltage and current near the end of Part A. In Exp 9, the data was also saved near the end of Part A. The first task today is to import the data you collected (one case at a time) into Matlab. Be sure to complete all steps below first for the signal diode 1N915 and then an LED. If you did not save this data, you will have to obtain it again. Start MATLAB and Import the data file. The Import Data command is found under the Home tab. You should see a window that looks something like this (Figure A-1), with three or four columns showing for time, one or two voltages and the Math Channel for current. Click on the green check mark at the upper right. A small window should appear showing the names of the variables. Note that it is possible to obtain the current column by either measuring the voltage across the resistor or by calculating the voltage across the resistor in the Math channel. The choice is yours. Figure A-1. 1. In MATLAB, plot the diode current vs. the diode voltage. You only want to display a representative range of data so you do not have to show larger negative voltages. However, for this exercise, it is recommended that you show as much data as possible so you get used to seeing what is possible. The m-file below shows how you might do this. This is a guide. (This m-file can also be accessed through the Matlab section of the course website.) % LED or Other Diode I-V Plots for Data Taken with the Analog Discovery % K. A. Connor, 4 April 2014 - Updated 25 October 2015 % Import Data From Spreadsheet % Click on Import Data from the Home Tab in Matlab 2015 % Select the CSV File You Stored in the Directory Where This Program is % Located. Once you have imported the file, type 'whos' to see what the % default name is for the array with the data in it. The names should K. A. Connor, - 2 - Revised: 26 October 2015

% also be listed in the Workspace window % Identify the Time Data time=times;% The first column is the time vector % Voltage Data v_diode=c1v;% The voltage across the diode, this may be different for you. % Current Data i_diode=m1a; % The current is measured by finding the voltage across a 1000 Ohm Resistor. % If you did not use the Math Channel on Analog Discovery, You may have % to divide a voltage channel by the resistance in your circuit. % There may be some instrumental offsets in the measurements. If they are % large enough to cause problems, they can be removed. Usually, this step % is not necessary, so the expressions below have been commented out. % You should calibrate your Analog Discovery board to minimize offsets. % Eliminate current offset; % i_diode=i_diode+8.3333e-004; % Eliminate voltage offset % v_diode=v_diode-0.55; % Plot the results plot(v_diode,i_diode,'.'); hold on;% This allows the next plot command to plot in the same figure grid; % axis([-2 4-1e-3 21e-3]); % The axes can be adjusted to produce a better plot. % Ideal Diode Equation is=1e-9;n=2; vd=[-4:.01:4]; id=is.*(exp(vd./(n.*.0259))-1.0); plot(vd,id,'linewidth',3,'color','r'); axis([-4 4 -.001.005]);% For most diodes, positive voltages are all that we % need to plot. However, you may want to extend the range to negative % voltages in some cases, as is usually done here. 2. Add a plot of the diode current equation to your Matlab figure. (This is done in the bottom part of the m- file.) Start with n=2, guess a value for I s, plug in several values for v D, and plot the points. Use 25.9mV for V T. Vary the value of I s until you get a reasonable fit. The figure below is the result of the MATLAB example on the output from the code on the previous page. You should be able to get a better fit. Consider using the grid command in MATLAB. If time permits, vary the value of n also. For real diodes, n is in the range of 1 to 2. Include a copy of this plot in your write-up. List the final n and Is. K. A. Connor, - 3 - Revised: 26 October 2015

6 x 10-3 5 4 3 2 1 Figure A-2. Diode current vs. diode voltage. Thin lines are plots of experimental data, thick lines are two attempts to fit the diode equation. One curve is for n = 2 & Is = 10-10, the other curve is for n = 2 & Is = 10-9 A. 3. Repeat the process for your LED data, save and annotate your I-V plot. Summary A diode is a device that allows current to flow in only one direction. An ideal diode looks like a short when the current is flowing and an open circuit when the current is not flowing. A real diode has a small voltage across it when it is on, a small negative current through it when it is off, a region in which it switches from on to off, and a breakdown region where it stops blocking the current entirely. As long as the voltages we use do not reach the voltage of the breakdown region, the diode will work close to ideal. Part B Load Lines Before beginning this section, watch the video on load lines (the link is found with Class #16 information). You should also read the Wikipedia entry on this topic (https://en.wikipedia.org/wiki/load_line_%28electronics%29). Analysis Our first load line task is to use a diode curve from a device spec sheet and graphically find its operating point solution when it is driven by a 5V battery through a 62Ω resistor. A generic LED circuit is shown in Figure B-1. 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 4. Begin by writing the equation for the load line in the form I = AV + B for the given voltage source and resistor. The diode I-V curve is only known experimentally and saved in graphical form. It is the current (I) vs Figure B-1 voltage (V) plot for an LED and is Figure 2 of http://users.ece.utexas.edu/~valvano/datasheets/ledorangehlmp-d401.pdf. (Reproduced as Figure B-2 below.) Note that the function is pretty close to a straight line except at low currents. Note also the units. I is in ma and V is in Volts. K. A. Connor, - 4 - Revised: 26 October 2015

Figure B-2(Figure 2 from reference above) 5. With the best accuracy you can manage, graphically determine the LED operating point. 6. Now that you have the idea of the load line, return to Matlab and add the load lines to the two diode I-V curves. Note that you will actually have a large number of load lines because the input voltage varies with time. Only draw the load lines for the maximum value of the input voltage. Be sure your load lines are consistent with the experimental setup you used to obtain your data. Use the load lines to identify the operating point. Part C Bode Plots: Working with db and a Variation of Phasors In this short section, we introduce three new concepts. Fortunately, we will consider them in fairly simple form, but they can be quite complicated. They are Decibels, Laplace Transforms and Bode Plots. So many physical phenomena can vary over orders of magnitude (e.g. sound levels) that engineers and scientists have developed an approach (Decibel) to plotting data that makes this broad range of values easier to work with. Before beginning this section, review the materials on Amplitude on the course webpage, especially the information on db (Decibel). Ratios of voltage or power can be written as K. A. Connor, - 5 - Revised: 26 October 2015

10 log P 10 20log P V db 10 o V o Where log 10 finds the power of 10 that is equivalent to the argument. Thus, if b log10 a then b a 10. In Matlab, we can write this as a1=10;b1=log10(a1);c1=10^b1; and a1=c1=10 and b1=1.. The use of db in spec sheets is very common. Thus, it is useful to be able to convert from db to voltage and power ratios and vice versa. 7. What are the voltage and power ratios that correspond to 3dB? Use an online calculator to check your answer. 1 We have seen that the complex transfer function used in phasor analysis for an RC filter can look like. 1 jrc In future courses, we will see that this can be generalized using two powerful ideas Fourier and Laplace Transforms. For the former, the transfer function will look the same as we have seen with phasors. For the Laplace 1 Transform, we replace jω with s so the RC transfer function looks like. As first year students, you really 1 src do not need to know about either type of transform except that Matlab uses Laplace transforms to specify transfer functions and we would like to make use of some of the built in functions provided. Now we finally get to Bode plots, which are what LTspice gives us when we do AC Analysis. That is, the magnitude and phase of the output given the input. To obtain the Bode plot, we have to write the transfer function as it would be seen if we were using Laplace Transforms. This is done by writing two vectors, one for the numerator and one for the denominator. For the RC filter, these are [0 0 1] and [0 R*C 1] which represent 0s 2 0s 1 and 0s 2 RCs 1, respectively. The transfer function RCR is then RCF=tf([0 0 1],[0 R*C 1]). Once this is specified, then the Bode plot with grid is produced by bode(rcf);grid; note that when you do this for a particular circuit, you need to use the actual value of the product of R and C. Also, the Bode plot will use the angular frequency ω for the horizontal axis. The vertical scale is in db. 8. Generate the Bode Plot in Matlab for R = 1kΩ and C = 1µF with the output voltage taken across C. Save your plot in your report and fully annotate it, noting, especially, the corner frequency. Also mark a few representative data points from when you analyzed this filter previously. Part D Task List Import I-V data for a signal diode and an LED into Matlab In Matlab, plot the I-V characteristics for both types of diodes Also, plot the ideal diode current equation for both types of diodes, compare and contrast your data and the best fit theoretical curve. TA/Instructor Determine the load line and operating point for the orange LED whose I-V curve is shown in Figure B-1. (No Matlab required for this task.) TA/Instructor Add load lines for the maximum value of the input voltage to both Matlab diode I-V curves Find the voltage and power ratios that correspond to 3dB. Use Matlab to generate the Bode plot for an RC filter. K. A. Connor, - 6 - Revised: 26 October 2015