ETT-311 SIGEx Lab Manual Signals & Systems Experiments with Emona SIGEx Volume 1 ETT-311 SIGEx Lab Manual Signals & Systems Experiments with Emona SIGEx Volume 1 Signals & Systems Experiments with Emona SIGEx Volume S1 - Fundamentals of Signals & Systems Authors: Robert Radzyner PhD Carlo Manfredini B.E., B.F.A. Editor: Carlo Manfredini Issue Number: 1.2 Published by: Emona Instruments Pty Ltd, 78 Parramatta Road Camperdown NSW 2050 AUSTRALIA. web: www.emona-tims.com telephone: +61-2-9519-3933 fax: +61-2-9550-1378 Copyright © 2011 Emona TIMS Pty Ltd and its related entities. All rights reserved. No part of this publication may be reproduced or distributed in any form or by any means, including any network or Web distribution or broadcast for distance learning, or stored in any database or in any network retrieval system, without the prior written consent of Emona Instruments Pty Ltd. For licensing information, please contact Emona TIMS Pty Ltd. NI, NI ELVIS II/+, NI LabVIEW are registered trademarks of National instruments Corp. The TIMS logo Emona TIMS Pty Ltd Printed in Australia is a registered trademark of EMONA SIGEx Lab Manual Volume 1 Contents Introduction (i) How to handle, install and power up SIGEx™: ESD Warning, Unpacking, Handling, Set-up and ESD Preventative Measures An introduction to the NI ELVIS II/+ test equipment S1-01 An introduction to the SIGEx experimental add-in board S1-02 SIGEx board circuit modules NI ELVIS functions SIGEx Soft Front Panel descriptions Special signals – characteristics and applications S1-03 Pulse sequence speed throttled by inertia Isolated step response of a system Isolated pulse response of a system Sinewave input Clipping Systems: Linear and non-linear S1-04 Conditions for linearity The VCO as a system A feedback system Testing for additivity Frequency response Unraveling convolution S1-05 Unit pulse response The superposition sum A rectified sinewave at input A sinewave input Mystery applications Integration, correlation & matched filters Auto-correlation function of PRBS sequences Cross-correlation function of PRBS sequences ACF & matched filtering Determining impulse response using input/output correlation Matched filtering using “integrate & dump” circuitry S1-06 Exploring complex numbers and exponentials S1-07 Complex numbers and complex functions Exponential functions Build a Fourier series analyzer S1-08 Constructing waveforms from sine & cosine Computing Fourier coefficient Build a manually swept spectrum analyzer Analyzing a square wave Spectrum analysis of various signal types S1-09 Spectrum of impulse trains Spectrum of filtered impulse trains Duty cycle & sampling Sync pulse train Spectrum of PN sequences Analog noise generation (AWGN) Non-linear processes Time domain analysis of an RC circuit S1-10 Step response of the RC Impulse response of the RC Exponential pulse response of the RC Synthesising transfer functions Poles and zeros in the Laplace domain S1-11 System with feedback only – allpole Impulse response of LTIC systems Feedback and feedforward – poles & zeros Allpass circuit Critical damping & maximal flatness Sampling and Aliasing S1-12 Through the time domain – PAM, Sample & Hold Through the frequency domain Aliasing and the Nyquist rate Multi-frequency impulse spectrum Uses of undersampling in Software Defined Radio Getting started with analog-digital conversion PCM encoding & quantization PCM decoding & reconstruction Frame synchronisation & quantization noise S1-13 Discrete-time filters with FIR systems S1-14 Graphical plotting of response from poles & zeros Notch filter creation using two-delay FIR Poles and zeros in the z plane with IIR systems S1-15 Relating roots to coefficients in the quadratic polynomial IIR without feedforward – a second order resonator IIR with feedforward – second order filters Viewing spectrum with broadband noise & FFT Dynamically varying the poles & zeros Using the “Digital Filter Design” toolkit Discrete-time filters – practical applications S1-16 Dynamic range at internal nodes Transposed Direct form 2 IIR Implementations with high sampling rates Appendix A: SIGEx Lab to Textbook chapter table S1-A Appendix B: Quickstart guide to using SIGEx S1-B References Electrostatic Discharge Sensitive Product CAUTION: The inputs/outputs of this product can be damaged if subjected to Electrostatic Discharge (ESD). To prevent damage, industry-standard ESD prevention measures must be employed during installation, maintenance, and operation. Refer to page v for detailed information. Introduction This experiment manual is designed to provide a practical “hands-on”, experiential, lab-based component to the theoretical work presented in lectures on the topics typically covered in introductory “Signals and Systems” courses for engineering students. Whilst it is predominantly focused on all electrical engineering students, this material is not exclusively for electrical engineers. With an understanding of differential equations, algebra of complex numbers and basic circuit theory, engineering students in general can reinforce their understanding of these important foundational principles through practical laboratory course work where they see the “math come alive” in real circuit based signals. This provides a foundation for further study of communications, control, and systems engineering in general. Students take responsibility for the construction of the experiments and in so doing learn from their mistakes and consolidate their knowledge of the underpinning theory, which at times is particularly abstract and hard to grasp for these early engineering students. They are not constrained by the software and need to be systematic in debugging their own systems when results do not meet their expectations. The common reaction of early students when confronted with “complex analysis” is one of confusion and regression to “rote-learning” in order to survive the examination process. This manual has as its predominant aim to create real, “hands-on” implementation of the theory, in such a way that the student can directly articulate and connect the mathematical abstractions with real world implementations. It is a journey of personal discovery where the motto is “why is it so ?” The use of “modeling” is the fundamental tool in this, and other NI ELVIS-based EMONA boards (such as DATEx, FOTEx and HELEx), and it has been shown that experimenting with scaled models of real world systems allows students early-on to get a tangible “feel” for principles that they may later utilize in real world commercial workplace environments. As well, students tend to “believe” results from “real hardware” rather than from software simulations, and this supports their “learning by doing”. The authors sincerely hope that students using this equipment and guided by this manual will complete with a sense that complex numbers and systems analysis “makes sense” and is somehow more “real” and applicable to real world problems. In this way they may successfully use these principles in solutions to future problems they will encounter. Carlo Manfredini Sydney, November 2013 How to handle, install and power up SIGEx™ with NI ELVIS II/+ ESD Warning – ESD Sensitive Product Caution Although this product has been designed to be as robust as possible, ESD (Electrostatic Discharge) can damage or upset this product. This product must be protected at all times from ESD. Static charges may easily produce potentials of several kilovolts on the human body or equipment, which can discharge without detection. Industry-standard ESD precautions must be employed at all times. The Emona ETT-311 board is designed and intended for use as an experimental platform for hardware or software in an educational/professional laboratory environment. To facilitate usage, the board is manufactured with its components and connecting traces openly exposed to the operator and the environment. As a result, ESD sensitive (ESDS) components on the board, such as the semiconductor integrated circuits, can be damaged when exposed to an ESD event. To indicate the ESD sensitivity of the Emona ETT-311 board, it carries the symbol shown at left. Unpacking, Transporting, and Storage When unpacking the Emona ETT-311 board from its shipping carton, do not remove the board from the antistatic packaging material until you are ready to complete the installation. Before unwrapping the antistatic packaging, discharge yourself by touching a grounded bare metal surface, touching an approved anti-static mat, or wearing an ESD strap. When transporting or storing the Emona ETT-311 board, first place it in an antistatic container or packaging. Handling and Setup Handling the Emona ETT-311 board can damage the board components if ESD prevention measures are not applied. Before handling or setup, equalize your potential with the board by touching one of the integrated ESD discharge pads. During all handling and setup, ESD prevention measures must be applied. In addition, the Emona ETT-311 board should be handled by the edges. Touching exposed circuits, components or connectors could result in an ESD event. When setting up Emona ETT-311 board, observe the following guidelines to minimize the potential impact of ESD: • Patch the desired experiment blocks using 2mm patch cords. • Set switches and other controls to initial settings. • Ensure the NI ELVIS is powered correctly by plugging the NI ELVIS AC/DC power supply brick into an appropriate AC outlet. • Move the board power switch ON. Operation When operating the Emona ETT-311 board, ESD can cause upset as well as damage to the board components. Therefore, apply ESD prevention measures whenever operating the Emona ETT-311 board. In addition, observe the following guidelines: • Do not touch exposed traces or components on the board while the board is powered on. • Exercise caution when manipulating switches, buttons, knobs, and other controls while the board is powered on. ESD Prevention Measures ESD prevention measures focus on reducing or eliminating the build-up of static charge that may result in an ESD event that could damage or upset sensitive electronics. To minimize the potential for an ESD event, implement the following measures: • Perform all work at an approved work station. • Use an approved antistatic mat to cover your work surface. • Wear a conductive wrist strap attached to the antistatic mat and a good earth ground. • Before handling or beginning work, equalize your potential with the board by touching one of the “GND” pads. Handling SIGEx When holding SIGEx, always hold the circuit board by the edges, as illustrated. Hold SIGEx by the edges How not to hold SIGEx Ensure NI ELVIS II/+ Prototype Board Power OFF Before installing the SIGEx add-in module in the NI ELVIS II/+ PROTOTYPE PCI SLOT, always check the PROTOTYPING BOARD POWER switch is in the OFF position. Ensure Prototype Board Power is OFF Installing SIGEx on NI ELVIS II/+ When installing the SIGEx add-in module in the NI ELVIS II/+ PROTOTYPE PCI SLOT, always carefully check the alignment is correct before pushing SIGEx into position. Carefully align SIGEx with the NI ELVIS socket Carefully push SIGEx into position Check for correct bracket alignment Power up SIGEx After SIGEx is correctly positioned, turn the NI ELVIS II/+ Prototyping Board Power switch ON. Turn NI ELVIS Prototype Board Power ON Before removing SIGEx™ from the NI ELVIS II/+ Ensure NI ELVIS II/+ Prototype Board Power is OFF Before removing the SIGEx add-in module from the NI ELVIS II/+ PROTOTYPE PCI SLOT, always turn the PROTOTYPING BOARD POWER switch OFF. ALWAYS STORE THE SIGEx BOARD IN A ESDSAFE PLASTIC BAG – AS SUPPLIED WITH ORIGINAL PACKAGING. Ensure Prototype Board Power is OFF before removing SIGEx SIGEx ™ QUICK START - INSTALLATION AND OPERATION The following guide outlines the steps required to install and use the NI ELVIS platform and the Emona SIGEx add-in module. 1. Installation of NI components • Install LabVIEW on your PC – follow NI LabVIEW Installation Guide • Install NI ELVIS software – follow the NI ELVIS installation Guide 2. Installation of Emona SIGEx components • Install Emona SIGEx software using the SIGEx CD-ROM supplied. Refer to page 21 of this User Manual for detailed installation instructions. The installation will include the SIGEx SFP, the User Manual and Lab Manual PDF files. 3. Setting-up the NI hardware components • Make all power and interface connections between the PC, NI DAQ and NI ELVIS • Power-up NI DAQ and NI ELVIS; Launch the NI ELVIS LAUNCHER software. This will most likely occur automatically when NI ELVIS is detected. 4. Set-up of the Emona SIGEx add-in module • Confirm the NI ELVIS’ “PROTOTYPING BOARD POWER” switch is OFF. • Holding the SIGEx board by its outer edges, position it on the top of the NI ELVIS platform. Carefully align the SIGEx circuit board with the NI ELVIS PCI socket and slide into position. 5. Operation • Power-up the SIGEX add-in module by switching the NI ELVIS’ “PROTOTYPING BOARD POWER” switch to ON. Confirm the the SIGEx board’s 3 red power LEDs at the left hand side are lit. • Patch together experiments following the instructions of the SIGEx Lab Manual. The SIGEx kit includes all equipment required: patching wires and oscillscope leads. • The NI ELVIS platform powers the SIGEx add-in module, provides the test instruments and interface between NI LabVIEW and the SIGEx add-in module. 6. SIGEx front panel conventions • The SIGEx add-in module follows strict labelling conventions to assist the student in building and exploring experiments. For details see page "iii" of this User Manual. In brief: Terminals with a CIRCLE label only take analog signals. (typically + 2V) Terminals with a SQUARE label only take digital type signals. ( +5V TTL-level) INPUT terminals are always on the LEFT of each functional block. OUTPUT terminals are always on the RIGHT of each functional block. 7. Power down and unplug SIGEx • Always switch the NI ELVIS’ “PROTOTYPING BOARD POWER” switch to OFF before removing the SIGEx add-in module. • Please handle the SIGEx add-in module by the outer edges of the circuit board and store in the anti-static bag provided. THIS PAGE IS INTENTIONALLY BLANK Experiment 1 – An introduction to the NI ELVIS II/+ laboratory equipment Preliminary discussion The digital multimeter and oscilloscope are probably the two most used pieces of test equipment in the electronics industry. The bulk of measurements needed to test and/or repair electronics systems can be performed with just these two devices. At the same time, there would be very few electronics laboratories or workshops that don’t also have a DC Power Supply and Function Generator. As well as generating DC test voltages, the power supply can be used to power the equipment under test. The function generator is used to provide a variety of AC test signals. Importantly, NI ELVIS II has these four essential pieces of laboratory equipment in one unit (and others). However, instead of each having its own digital readout or display (like the equipment pictured), NI ELVIS II sends the information via USB to a personal computer where the measurements are displayed on one screen. On the computer, the NI ELVIS II devices are called “virtual instruments”. However, don’t let the term mislead you. The digital multimeter and scope are real measuring devices, not software simulations. Similarly, the DC power supply and function generator output real voltages. As well as the instruments mentioned above, the NI ELVIS II has available eight analogue inputs and two analog outputs which can be controlled and written to by our LabVIEW program and the input readings processed and displayed on screen. This allows for the creation of many more custom "virtual instruments" which may be required in a particular experimental setup. The experiments in this manual make use of several of the available analogue inputs as well as several digital inputs and outputs which, in conjunction with the SIGEx board, are able to implement two groups of programmable gain amplifiers for use throughout this manual. Rather than utilising several independent instruments from the NI ELVIS as does the other EMONA plug-in accessory boards (such as EMONA DATEx Telecoms-Trainer and the EMONA FOTEx Fiber optics trainer), these instruments are all merged into one full-screen virtual instrument for the SIGEx board known as the SIGEx Main soft front panel (SFP). With an easyto-use tabbed layout, each experiment has its requisite instrumentation grouped within tabs by experiment. 1-2 © 2011 Emona Instruments Experiment 1 – An introduction to the NI ELVIS II/+ test equipment V1.2 When an NI ELVIS1 unit is connected to a PC it will automatically run the Instrument Launcher panel as shown below: Figure 1: NI ELVIS II/+ Instrument Launcher panel This panel gives the user access to each individual instrument. Several of these independent instruments are used by SIGEx experiments. These are the FUNCTIONS GENERATOR (FGEN), the DYNAMIC SIGNAL ANALYSER (DSA) and at times the SCOPE (Scope). When using NI ELVIS with the EMONA SIGEx board to conduct signals and systems experiments the user will run the SIGEx Main SFP VI shown below: Figure 2: SIGEx Main SFP 1 Throughout this manual, NI ELVIS II & II+ are referred to, however the SIGEx board and software work equally well on the NI ELVIS I platform, with the NI ELVIS I FUNCTION GENERATOR used in manual mode ONLY, and NI ELVIS in BYPASS mode. Experiment 1 – An introduction to the NI ELVIS II/+ test equipment © 2011 Emona Instruments 1-3 There are 19 TABS for use with the experiments in this Volume of the manual. These instruments take their signals directly from the SIGEx board via the EMONA ETT-040 Universal Base Board, into the ELVISmx circuitry, and after processing by LabVIEW are displayed on screen as required. The combination of the LabVIEW programmability of the NI ELVIS unit as well as the numerous analog and digital inputs and outputs available make it convenient to create customised instrumentation for use in real world hands-on experimentation. The EMONA SIGEx board is a good example of this integration of available hardware and the software control. 1-4 © 2011 Emona Instruments Experiment 1 – An introduction to the NI ELVIS II/+ test equipment V1.2 Experiment 2 – An introduction to the EMONA SIGEx experimental add-in board for NI ELVIS Preliminary discussion The experiments possible with the EMONA SIGEx board bring together worlds of mathematical theory and practical implementation. We are able to explore, in a hands-on manner, the representation of physical processes by mathematical models and test and measure the benefits and limitations of such models. We explore the complementarity of the time and frequency domains and practice thinking and theorizing in both. Through measurements, calculations and observations we are able to consolidate our understanding of these domains. The SIGEx board customizes the instrumentation available on the NI ELVIS to create experiment-specific instruments which can be used to create many different circuit structures. As well, the ability to programmatically control, measure and automate our measurements using LabVIEW bring us closer to real-world practices of system control and monitoring. Although the principles of being studied date back several centuries their application in real world devices is continually being explored and implemented. The instrumentation used has changed substantially however the rigorous nature of the mathematical process remains the same and is a skill which is best learned in a hands-on manner. By implementing the many mathematical model and theorems in real hands-on circuit based experiments, the student reinforces and actualizes their understanding of these principles to create a solid foundation for future learning. An important skill for the engineer and scientist is the ability to take rigorous and precise measurements, often repetitively, in order to study the phenomena at hand. The EMONA SIGEx Signals & Systems Experimenter (ETT-311) provides an abundance of opportunities to learn and practice experimental methodology in a variety of related topics which are common ground for engineering students of several disciplines. 2-2 © 2011 Emona Instruments Experiment 2 – An introduction to the SIGEx experimental add-in board V1.2 The experiment For this experiment you will familiarize yourself with the various instruments available on the SIGEx board and how they are used. It should take you about 10 minutes to read this experiment and explore these functions. Pre-requisites: You should have completed the introductory chapter 1 so that you’re familiar with the equipment setup and capabilities. Equipment PC with LabVIEW Runtime Engine software appropriate for the version being used. NI ELVIS 2 or 2+ and USB cable to suit EMONA SIGEx Signal & Systems add-on board Assorted patch leads Two BNC – 2mm leads Experiment 2 – An introduction to the SIGEx experimental add-in board © 2011 Emona Instruments 2-3 Procedure Part A – Setting up the NI ELVIS/SIGEx bundle 1. Turn off the NI ELVIS unit and its Prototyping Board switch. 2. Plug the SIGEx board into the NI ELVIS unit. Note: This may already have been done for you. 3. Connect the NI ELVIS to the PC using the USB cable. 4. Turn on the PC (if not on already) and wait for it to fully boot up (so that it’s ready to connect to external USB devices). 5. Turn on the NI ELVIS unit but not the Prototyping Board switch yet. You should observe the USB light turn on (top right corner of ELVIS unit).The PC may make a sound to indicate that the ELVIS unit has been detected if the speakers are activated. 6. Turn on the NI ELVIS Prototyping Board switch to power the SIGEx board. Check that all three power LEDs are on. If not call the instructor for assistance. 7. Launch the SIGEx Main VI. 8. When you’re asked to select a device number, enter the number that corresponds with the NI ELVIS that you’re using. 9. You’re now ready to work with the NI ELVIS/SIGEx bundle. Note: To stop the SIGEx VI when you’ve finished the experiment, it’s preferable to use the STOP button on the SIGEx SFP itself rather than the LabVIEW window STOP button at the top of the window. This will allow the program to conduct an orderly shutdown and close the various DAQmx channels it has opened. Ask the instructor to check your work before continuing. 2-4 © 2011 Emona Instruments Experiment 2 – An introduction to the SIGEx experimental add-in board V1.2 EMONA SIGEx board overview The SIGEx board is a collection of independent circuit blocks which each implement a single simple function. No one block is a complete experiment, however several blocks together can implement a wide variety of different experiments. The block inputs and outputs are patched together with 2 mm patching leads according to the block diagram as documented in this Lab Manual or from the many texts available on this topic. EMONA SIGEx board layout This chapter discusses the functionality of each module briefly and further details such as specifications are contained in the EMONA SIGEx User Manual. NI ELVIS II/ SIGEx bundle Experiment 2 – An introduction to the SIGEx experimental add-in board © 2011 Emona Instruments 2-5 SIGEX board circuit modules Sequence Generator The SEQUENCE GENERATOR provides a source of periodic data streams which are output as 5V logic and bipolar level signals. DIP switches allow the selection of 4 different streams. A periodic SYNC pulse is output once per frame. The module is clocked by a single input logic level clock. This will typically come from the PULSE GENERATOR or FUNCTION GENERATOR/SYNC outputs. The state of the DIP switches at any time is displayed on the SIGEx SFP along with a description. Limiter The LIMITER amplifies an incoming signal with DIP switch selectable gain levels and to a fixed level, creating an amplitude limited output signal. It is typically used with bipolar analog sinusoidal signals or bipolar line coded data streams. RC Network The RC NETWORK provides R and C elements which can be arranged as either an RC circuit which acts as a LPF, or as a HPF. The elements are floating and one end needs to be connected to GND. Rectifier The Rectifier provides half wave rectification of an incoming signal with a non ideal diode component which has a forward voltage drop. This is typically used with sinusoidal signals. 2-6 © 2011 Emona Instruments Experiment 2 – An introduction to the SIGEx experimental add-in board V1.2 Multiplier The Multiplier provides four quadrant multiplication of two analog input signals. Its overall gain is approximately unity and it is used to model any multiplication process that may occur in a block diagram. Integrate & Dump/Hold Both Integrate and Dump as well as Integrate and Hold is available in this circuit block. Usually clocked by the bit clock of an incoming sequence, it is used to integrate over a single period of a waveform in correlation and filtering functions. Baseband Low Pass Filter This LPF has a 4th order Butterworth response and serves both as a “system under investigation” and for general filtering functions. PCM Encoder This module implements PCM encoding of a single analog signal. It outputs an 8 bit frame along with a periodic Frame Sync pulse. It can be used with both DC signals as well as sinusoids and serves to allow specific investigation of the encoding process. It has a maximum sampling rate of 2.5ksps ( 20kbps PCM data stream), and so can be used with signal frequencies below the Nyquist limit of 1.25kHz. PCM Decoder This module implements PCM decoding of an 8 bit PCM digital data stream from the PCM Encoder. The Frame Sync is necessary to achieve synchronization and there is no reconstruction filter on the output to allow investigation of quantization issues. Experiment 2 – An introduction to the SIGEx experimental add-in board © 2011 Emona Instruments 2-7 Tuneable Low Pass Filter This module is an adjustable LPF. It implements a 8th order Elliptic filter with an adjustable corner frequency. The output signal level is also adjustable, and it can accept analog and TTL level digital signals. There is no anti-aliasing filter on the input so users need to be aware of the bandwidth of their incoming signal. Integrators These 3 independent circuits are simple integrator circuits with a common DIP-switchselectable integration rate. They are used for continuous time integration ( unlike the Integrate & Dump/Hold unit which operates over a single period only.) They are used in Laplace domain experiments. The DIP switch settings is displayed in the SIGEx SFP along with the approximate integration rate. Unit delays with Sample & Hold The Sample & Hold is an analog sampler circuit which holds the sampled value for a single period of the incoming TTL level clock signal. The unit delays are similar in that they hold the incoming analog value at their input for a single clock period. All 4 units share a common clock signal. 2-8 © 2011 Emona Instruments Experiment 2 – An introduction to the SIGEx experimental add-in board V1.2 Triple and dual input adders There are 3 adder sections. Two identical triple input adder sections and a dual input adder. The triple input adders, a & b, have adjustable gains. These gains are adjusted via the SIGEx SFP and are typically used to implement the taps in feedback and feedforward systems. The dual input adder has unity gain and is used for general purpose addition. The GAIN ADJUST knob is read by the SIGEx SFP software and can be used to manually adjust adder gains. Experiment 2 – An introduction to the SIGEx experimental add-in board © 2011 Emona Instruments 2-9 NI ELVIS functions blocks available on the SIGEx board Pulse generator / Digital out This module makes available the built in Pulse Generator from NI ELVIS which has a very broad range of frequency and duty cycle control. This is controlled from the SIGEx SFP and is usually used to provide digital clock signals to experiments. D-OUT-0 is a single digital output line which is available but currently unused in experiments. Function generator This module makes available the built in Function Generator from NI ELVIS which is a multifunction generator, with variable signal types, variable amplitude and variable frequency. It is controlled via its own instrument panel which available from the NI ELVIS Instrument Launcher panel. Analog out This module makes available the built in dual analog outputs from the DACs. These outputs are controlled from various SIGEx experiment TABs and can be modified to create any periodic waveforms required. 2-10 © 2011 Emona Instruments Experiment 2 – An introduction to the SIGEx experimental add-in board V1.2 EMONA SIGEx Soft Front Panel (SFP) descriptions The EMONA SIGEx Soft Front Panel serves both to control elements of the SIGEx hardware, as well as provide experiment specific measuring instrumentation in a handy, experiment-perTAB based layout. The layout is arranged so as to fit on screen easily with all parameters in view. The source code VI’s are provided on the SIGEx CD so that users can modify and customize the SFP arrangement and functionality if required. SIGEx is designed for university and college users and access to the LabVIEW “Digital Filter Design” toolkit is expected for full functionality to be available. EMONA SIGEx Soft Front Panel ADDER gain entry panel The triple input adders have variable gains which are set from the entry controls on the SFP. These gains can also be set programmatically as is done in several experiment TABS. The onscreen gains are transferred to the hardware automatically and continuously. Coefficient selector panel The position of the onboard GAIN ADJUST knob can be interpreted as a range of values set to a particular adder gain control. The radio button panel is used to select a particular gain control, or none. The center value and step size of each increment from the GAIN ADJUST knob must Experiment 2 – An introduction to the SIGEx experimental add-in board © 2011 Emona Instruments 2-11 also be set. This allows either a broad range of values or a narrow focused range of values to be adjustable via the knob. Pulse Generator panel In the panel the frequency and duty cycle of the PULSE GENERATOR block can be set. As well the spare D-OUT-0 line can be toggled. SG Sequence type and Integrator Gain readouts These readouts mimic the selection of the onboard DIP switches and the text briefly describes the signal type selected for convenience. Details of signals in the SIGEx User Manual. Analog OUT viewer This graph indicator displays the actual signal currently being output from the ANALOG OUT terminals from the DACs. These vary depending on the experiment selected, and this readout is convenient when SCOPE channels are being used for other signals. SCOPE Trig level, trig slope, triggered LED, trig select, timebase etc These controls are for the SFP scopes embedded in various experiment TABs. Trig level sets the voltage level the trigger looks for. Usually set to 0 or 1 V Trig slope allows triggering on either the positive or negative edge of a signal. Triggered LED is ON (green) when a trigger point , as defined above, is detected. Trig select determines which channel acts as the trigger. Timebase varies the amount of real signal time to be captured and displayed. Total time displayed is selectable. RUN/STOP enables halting of the scope display for close inspection. Y autoscale ON: enables toggling of the Y axis autoscale function for stable signal viewing with varying amplitude signals. This built in scope is a convenient, customized signal display for use in specific experiments. Spectrum display is also available in certain TABs when required. Note for ELVIS 2+ users Due to the independent scope instrumentation available in the ELVIS 2+ it is possible to simultaneously use the independent scope from the Instrument Launcher panel as well as viewing the signals in the TAB based scope display. The Dynamic Signal Analyser (DSA), a spectrum analyser, can also be used, but not at the same time as the independent scope. 2-12 © 2011 Emona Instruments Experiment 2 – An introduction to the SIGEx experimental add-in board V1.2 Laboratory Experiment ‘X’ TABS Each experiment in the SIGEX Lab Manual has its own SFP TAB if required. Select the TAB as required and the appropriate instrumentation will be displayed. Labs 3 to 18 have TABs available. Some graphs also have cursors enabled. These are very useful for taking accurate & quick measurements. HINT: Right-clicking on a graph will display extra available options you can use. Different options are available when you right-click while the SFP is not running eg: setting a graph from linear to log display is done while SFP is not running. Digital Filter Design TAB This TAB makes available several of the digital filter design features from the toolkit in one handy display. The user should select a filter type from which the transfer function will be calculated. The coefficients from the transfer function are extracted and setup on the SIGEx hardware as the triple ADDER gains when required by the user. This can be seen on the SFP. The calculated responses are displayed onscreen. To view the actual signals and responses from the hardware, switch to a TAB which contains a scope and FFT, for example the ZOOM FFT TAB, whilst inputting an appropriate source signal. Note that SIGEx is limited to implementing only up to 2nd order filters. A red “error” LED will highlight when orders >2 are selected. Experiment 2 – An introduction to the SIGEx experimental add-in board © 2011 Emona Instruments 2-13 ZOOM FFT TAB This TAB contains a scope display, a spectrum display, and a zoomable view of the FFT display. This TAB is a general purpose display TAB and is not associated with any particular experiment. The FFT display is a 1000 point display, and the “# samples” control allows the user to select a zoom window from 0 to 1000 points to display alongside. The “zoom region” slider enables the zoom region to be selected from the overall 1000 point FFT display. PZ PLOT TAB This TAB uses components from the Digital Filter Design toolkit to calculate and plot the poles and zeros on the unit circle from the coefficients of the transfer function as it is set up on the SIGEx board. The coefficient values from the triple ADDER gain controls are read by this TAB and plotted as the equivalent poles and zeros in real time. This is especially interesting when the coefficients are being varied manually by the onboard GAIN ADJUST knob, in that the user can see the poles and zeros moving about the unit circle in real time alongside the hardware. 2-14 © 2011 Emona Instruments Experiment 2 – An introduction to the SIGEx experimental add-in board V1.2 Experiment 3 – Special signals – characteristics and applications Achievements in this experiment Time domain responses are discovered: step and impulse responses as paradigms for the characterization of system inertia; sinewaves were used as probe signals; clipping was applied to the recovery of a digital signal. Preliminary discussion Bandwidth is a term that has been in the engineering vocabulary for many decades. Its usage has extended over time, especially in the context of digital systems. It has become commonplace now to mean information transfer rate, and all Internet users know that broadband stands for fast, and better. There are highly competitive markets demanding top performance – ever higher speed whilst maintaining a low probability of corruption. However, as speed is increased, obstacles emerge in the form of noise, interference and signal distortion. At the destination these limitations become digital errors, resulting in pixellated images, and audio breaking up. Engineers involved in the design of these systems must assess the suitability of numerous components and sub-units e.g. adequate speed of response ?, too noisy, distorted? They will need to benchmark the behaviour of subsystem. The procedures that are used for modelling and testing must be universally accepted. The most important consideration affecting the speed of a digital signal is the switching process to produce a change of state. The switching time can never be instantaneous in a physical system because of energy storage in electronic circuitry, cabling and connecting hardware. This energy lingers in stray capacitance and inductance that cannot be completely eliminated in wiring and in electronic components. The effect is just like inertia in a mechanical system. A universal procedure is needed to characterize, measure and specify ‘inertia’. Various paradigms have become established over many years of application. One of these is the step response. For this reason, the step function has become one of the special signals in systems engineering. There are other signal types of importance. The sinusoid or sinewave heads the list of the range of applications. There are many others, including the impulse function, ramps, pseudonoise waveforms and pseudorandom sequences, chirp signals. This Lab has its focus on signals that are most needed for basic operations. Other signals will be introduced progressively in succeeding labs. Figure 1: step, impulse and sinusoid signals 3-2 © 2011 Emona Instruments Experiment 3 - Special signals – characteristics and applications V1.2 The experiment In Part 1 we investigate how signals are distorted when a system's response is affected by inertia, and discover signals that are useful for probing a system's behaviour. In Part 2 we introduce the sinewave, and observe how the systems investigated in Part 1 respond to inputs of this kind. Signals that have been subjected to amplitude limiting, also known as clipping, are commonly encountered when excessive amplification is used, such as in audio systems, resulting in overload distortion. In Part 3 we generate clipped signals and examine a useful application of clipping. As this experiment is a process of discovery, we will name the blocks which represent the channel “ System Under Investigation” until we have familiarized ourselves with their actual characteristics. It should take you about 45 minutes to complete this experiment. Pre-requisites: Familiarization with the SIGEx conventions and general module usage. A brief review of the operation of the SEQUENCE GENERATOR module. No theory required. Equipment PC with LabVIEW Runtime Engine software appropriate for the version being used. NI ELVIS 2 or 2+ and USB cable to suit EMONA SIGEx Signal & Systems add-on board Assorted patch leads Two BNC – 2mm leads Figure: TAB 3 of SIGEx SFP Experiment 3 - Special signals – characteristics and applications © 2011 Emona Instruments 3-3 Procedure Part A – Setting up the NI ELVIS/SIGEx bundle 1. Turn off the NI ELVIS unit and its Prototyping Board switch. 2. Plug the SIGEx board into the NI ELVIS unit. Note: This may already have been done for you. 3. Connect the NI ELVIS to the PC using the USB cable. 4. Turn on the PC (if not on already) and wait for it to fully boot up (so that it’s ready to connect to external USB devices). 5. Turn on the NI ELVIS unit but not the Prototyping Board switch yet. You should observe the USB light turn on (top right corner of ELVIS unit).The PC may make a sound to indicate that the ELVIS unit has been detected if the speakers are activated. 6. Turn on the NI ELVIS Prototyping Board switch to power the SIGEx board. Check that all three power LEDs are on. If not call the instructor for assistance. 7. Launch the SIGEx Main VI. 8. When you’re asked to select a device number, enter the number that corresponds with the NI ELVIS that you’re using. 9. You’re now ready to work with the NI ELVIS/SIGEx bundle. 10. Select the EXPT 3 tab on the SIGEx SFP. Note: To stop the SIGEx VI when you’ve finished the experiment, it’s preferable to use the STOP button on the SIGEx SFP itself rather than the LabVIEW window STOP button at the top of the window. This will allow the program to conduct an orderly shutdown and close the various DAQmx channels it has opened. Ask the instructor to check your work before continuing. 3-4 © 2011 Emona Instruments Experiment 3 - Special signals – characteristics and applications V1.2 Part 1a – Pulse sequence speed throttled by inertia In this set of exercises we continue the digital theme introduced above and explore the behaviour of signals in transit through a channel that has a limited speed of switching. SEQUENCE SOURCE S.U.I. Figure 1a: block diagram of the setup for observing the effect of a system (SUI) on a digital pulse sequence. Figure 1b: SIGEx model for Figure 1a. 11. Patch up the model in Figure 1b. The settings required are as follows: PULSE GENERATOR: FREQUENCY=1000; DUTY CYCLE=0.50 (50%) SEQUENCE GENERATOR: DIP switch to UP:UP for a short sequence. SCOPE: Timebase 10ms; Rising edge trigger on CH0; Trigger level=1V Set up the CH0 scope lead to display the LINE CODE output of the SEQUENCE GENERATOR 12. Measure the smallest interval between consecutive transitions . Compare this with the duration of one period of the clock by moving the scope lead to view the SEQUENCE GENERATOR CLK input from the PULSE GENERATOR. Question 1 What is the minimum interval of the SEQUENCE GENERATOR data ? We could think of these sequences as streams of logic levels in a digital machine, possibly representing digitized speech or video. The information elements in this stream are the unit Experiment 3 - Special signals – characteristics and applications © 2011 Emona Instruments 3-5 pulses. They are sometimes called symbols. Verify that there is one symbol per clock period. Since the clock frequency is 1000 Hz, the symbol rate is 1000 per second. The symbols in this sequence have only two possible values, so they are called binary symbols, and the transmission rate is commonly expressed as bits/sec. 13. Connect the CH0 lead to the output of the BASEBAND LPF module (BLPF) and connect the CH1 lead to the output of the TUNEABLE LPF module (TLPF). Set the TLPF FREQ so the output appears similar to that from the BASEBAND LPF, as shown in Figure 1c. TLPF GAIN: set knob to 12 o’clock Figure 1c: example signals Note the presence of oscillations on both signals and the differences between them. Where possible you should venture comments. You are not expected to have any prior knowledge of these waveforms. Question 2 Describe the signal transitions for both outputs: 14. With the clock remaining unchanged on 1000 Hz measure the time for each signal to change state. Is it the same for low to high (amplitude) as for high to low ? Specify the reference points you are using on the amplitude range, eg 1% to 99%, 10% to 90%. Note these values in the table below. “Freeze” the signals using the “RUN/STOP” SFP switch in order to take your measurements, and use the TRIGGER SLOPE control to select between rising and falling edge capture. NOTE: Disconnect the RC NETWORK when measuring the other systems as it loads the output LINE CODE signal slightly and affects the measurements. TIP: Calculate the levels you wish to measure and use the X & Y cursors as guidelines. 3-6 © 2011 Emona Instruments Experiment 3 - Special signals – characteristics and applications V1.2 Table 1: transition times for sequence data Range (%) BLPF@1kHz (us) TLPF@1kHz (us) BLPF@1.5kHz (us) TLPF@1.5kHz (us) 10-90 rising 10-90 falling 1-99 rising 1-99 falling 15. Next, increase the clock frequency to around 1.5 kHz. Repeat the measurements in Task 14 above, and compare the two sets of results. 16. Progressively increase the clock frequency, and carefully observe the effect on the output waveform. Note that something significant occurs above 2 kHz. Confirm that below 2 kHz the original transitions can be unambiguously discerned at the channel output, even though they are not sharp. Describe your observations as the clock is taken to 3 kHz and above. Are you able to correctly identify the symbols of the original sequence from the distorted output waveform? Estimate the highest clock frequency for which this is possible. Venture an explanation for the disappearance of transitions in this channel. Question 3 Describe the signal transitions for both outputs: In the next segment we will closely examine the shape of the transition corresponding to an isolated step excitation. Part 1b – isolated step excitation of a system STEP SOURCE S.U.I. Figure 1c: block diagram of step excitation arrangement Experiment 3 - Special signals – characteristics and applications © 2011 Emona Instruments 3-7 Figure 1d: SIGEx model Figure 1c. 17. Connect signals as shown in Figure 1d above. Connect CH0 to the BLPF output and CH1 to the TLPF output, and view both signal on the scope. Settings are as follows: 18. PULSE GENERATOR: FREQUENCY=250; DUTY CYCLE=0.50 (50%) SCOPE: Timebase 2ms; Rising edge trigger on CH0; Trigger level=1V Confirm that the scope time base is set to display not more than two transitions. Use RUN/STOP to freeze scope display. Figure 1e: example signals:50% figure Observe the channel's response to a single transition (you can use scope trigger and other time base controls to display a LO to HI transition or a HI to LO transition). Confirm that the shape of the output transition is similar to the shapes you observed in Task 13 above. When the response to a step excitation is isolated in this way, so that there is no overlap with the responses of neighbouring transitions, it is known as the step response. Note the presence of oscillations and the relatively long settling time to the final value (sometimes known as ringing -- a term that goes back to the days of manual telegraphy and Morse code). Compare with the waveform in Task 13 . Note that some of the transitions observed in Task 13 occur before the previous transition response has completely settled. 3-8 © 2011 Emona Instruments Experiment 3 - Special signals – characteristics and applications V1.2 The risetime of the step response is an indicator of the time taken to traverse the transition range. Various definitions can be found according to the application context. The frequently used 90% criterion is suggested as a convenient choice for this lab. 19. Measure and compare the risetime of the three step responses. Use this to estimate the maximum number of transitions per second that could be accommodated in each case (ignore the effect of the oscillations). Compare this with the results in Task 0.. Table 2: transition times for step input Range (%) BLPF (us) TLPF (us) RCLP (us) 10-90 rising 10-90 falling Graph 1: step response waveforms Experiment 3 - Special signals – characteristics and applications © 2011 Emona Instruments 3-9 Part 1c – isolated pulse response of a system An isolated pulse can also be used as an alternative to the use of an isolated step as the excitation to “probe” the behaviour of the system. The variable duty cycle of the PULSE GENERATOR serves as source of this signal. PULSE SOURCE S.U.I. Figure 1e: block diagram of pulse response investigation Figure 1f: model for pulse response investigation 20. Leave the patching as per the previous section, with the PULSE GENERATOR output connected to both S.U.I. With the frequency of the PULSE GENERATOR still set to 250 Hz, progressively reduce the DUTY CYCLE in steps as follows: 0.4, 0.3, 0.2, 0.1, 0.05 (5%). When you reach 0.1, move in steps of 0.01 eg. 0.09, 0.08, 0.07,... and observe the effect on the pulse width and pulse interval. Note that the transitions are not affected. As you continue to reduce the duty cycle, and thus reduce the input impulse width, the flat top between transitions gets shorter, and ultimately disappears. Since the rising transition is not able to reach its final value, it is not surprising that the amplitude of the pulse gets smaller. Question 4 Describe what happens when you reach 10% and 5% duty cycle ? 3-10 © 2011 Emona Instruments Experiment 3 - Special signals – characteristics and applications V1.2 21. Are you able to determine the ‘demarcation’ pulse width -- i.e. after which the response shape remains unchanging? Record the duty cycle value at which this occurs for all SUI’s in the table below. Table 3: pulse response readings BLPF TLPF RCLPF Duty cycle “demarcation” value Calculated pulse width (us) % of step response Period of oscillations (us) 22. Using the known PULSE GENERATOR frequency and the measured duty cycle, calculate and tabulate the input pulse width. 23. Express this as a percentage of the step response risetime, using the values from the previous section on step response, and note these values in the table above. Reflect on this for a moment, i.e. the response shape remaining apparently independent of the input pulse width -- this is an interesting discovery. 24. Move the scope leads so as to view the input pulse as CH0 and one of the SUI outputs on CH1.Note that for the both there are oscillations. The presence of these oscillations provides an opportunity for additional observations of shape changes as the width of the input pulse is reduced. There are many ways of testing this, eg. the number of sidelobes, their relative amplitudes, the intervals between zero crossings. 25. For each SUI, set the pulse width to the “demarcation” value and measure the period of the oscillations following the pulse. Note these in the table above. You have demonstrated that, provided the time span of the excitation signal is sufficiently concentrated, the shape of the response pulse is entirely determined by the characteristics of the system. We could think of this as the striking of a bell, or tuning fork, or of the steel wheel of a train to detect a crack. The system is hit with a short sharp burst of energy. INSIGHT: The response shape is not affected by the input signal. The energy burst used as input is called an impulse. The resulting response is called the impulse response. An impulse function is a mathematical construct derived from a physical pulse. The idea is straightforward. The pulse width is reduced to an infinitesimal value while maintaining Experiment 3 - Special signals – characteristics and applications © 2011 Emona Instruments 3-11 the energy constant. Naturally this implies a very large amplitude. The impulse function plays a central role as one of the fundamental signals in systems theory, with numerous ramifications. In the above exploration we discovered practical conditions that make it possible to generate a system's natural response or characteristic, i.e. a response that is not affected by the exact shape of the input excitation. Concurrently we have discovered a path to the definition of the impulse function and a vital bridge to link this mathematical abstraction to the world of physical signals. 26. With the setup unchanged, measure the delay at the peak of the output pulse and compare this with the delay of the step response measured earlier. 27. Return to your records of the step responses obtained in Steps 17 & 18. For each case, carry out a graphical differentiation with respect to time (approximate sketches are sufficient, however take care to achieve a good time alignment to identify key features). Compare these results with the records obtained in Task 23. As a useful adjunct exercise, consider a slightly modified step function in which the transition is a ramp with a finite gradient, though still quite steep. Carry out the differentiation with respect to time on this function, and compare with the above. Record your conclusion. Graph 2: differentiations of step response waveforms 3-12 © 2011 Emona Instruments Experiment 3 - Special signals – characteristics and applications V1.2 You have demonstrated that, provided the time span of the excitation signal is sufficiently concentrated, the shape of the response pulse is entirely determined by the characteristics of the system. We could think of this as the striking of a bell, or tuning fork, or of the steel wheel of a train to detect a crack. The system is hit with a short sharp burst of energy. The response shape is not affected by the input signal. The energy burst used as input is called an impulse. The resulting response is called the impulse response. An impulse function is a mathematical construct derived from a physical pulse. The idea is straightforward. The pulse width is reduced to an infinitesimal value while maintaining the energy constant. Naturally this implies a very large amplitude. The impulse function plays a central role as one of the fundamental signals in systems theory, with numerous ramifications. In the above exploration we discovered practical conditions that make it possible to generate a system's natural response or characteristic, i.e. a response that is not affected by the exact shape of the input excitation. Concurrently we have discovered a path to the definition of the impulse function and a vital bridge to link this mathematical abstraction to the world of physical signals. Experiment 3 - Special signals – characteristics and applications © 2011 Emona Instruments 3-13 Part 2 – Sinewave input As mentioned in the introduction, sinewaves are encountered in a large number of applications. The special role of the sinusoidal waveshape for system characterization is explored in Experiment 2, and further developed in Experiment 4. In this segment we just get our toes wet. We carry out some basic observations and compare the sinewave response of the various S.U.I’s with the impulse response obtained above. S.U.I. Figure 2a: block diagram of setup for sinewave investigation Figure 2b: patching model for Figure 2a. 28. Connect the FUNC OUT output from the FUNCTION GENERATOR to the inputs of both S.U.I. Launch the NI ELVIS Intrument Launcher and select the FUNCTION GENERATOR. Set up the FUNCTION GENERATOR as follows: Select: SINE wave Voltage range: 4V pp Frequency: 100 Hz Press RUN when ready. Connect CH0 of the scope to the output of the FUNCTION GENERATOR, and CH1 to output of S.U.I. Progressively increase the frequency from 100 Hz to 10 kHz and observe the effect on the amplitude of the output signal. Make a record of your findings in the form of a table of 3-14 © 2011 Emona Instruments Experiment 3 - Special signals – characteristics and applications V1.2 amplitude vs frequency. Enter your results into the table on the TAB3 SFP, which will plot those results. Consider the possible advantage of using log scales. To enable a “log” Y axis, stop the SIGEX SFP program, right click the plot graph, select Y scale > Mapping > Log. To return to Linear, repeat this process and select “Linear”. Table 4: amplitude vs frequency readings Frequency (Hz) BLPF (Vpp) TLPF(Vpp) RCLPF(vpp) 29. Refer to the results you obtained and sketched of the step response in Question 19. Notice the similarity of the step response shape to a half cycle of a sinewave. Estimate the frequency of the matching sinewave. Examine the graph obtained in the above task and see whether any feature worth noting appears near this frequency. Question 5 What frequency would a matching sinewave have ? Question 6 Describe what happens to the frequency response plotted on the SFP at this frequency ? Experiment 3 - Special signals – characteristics and applications © 2011 Emona Instruments 3-15 30. Return to the observations you recorded in Task 19. A physical mechanism was proposed there to explain the reduction in pulse response amplitude as the width of the input pulse was progressively made smaller. Consider whether the reduction in output amplitude of the sinewave with increasing frequency could be explained through a parallel argument. Question 7 What was the mechanism described earlier ? Part 3: clipping A common example of voltage clipping or limiting occurs in amplifiers when the signal amplitude is too high for the available DC supply voltage headroom. In audio systems clipping is undesirable as it causes distortion of the sound. However, in other applications, a clipped signal can be useful. We examine the operation of the voltage LIMITER and try out an application. First we find out how it can be used to convert a sinewave to a square wave. Figure 3a: block diagram for clipping a sinewave Figure 3b: wiring model for Figure 3a 3-16 © 2011 Emona Instruments Experiment 3 - Special signals – characteristics and applications V1.2 31. Patch up the system in Figure 3b. As we will be using the MEDIUM mode of the LIMITER unit, the on-board switches must be set accordingly (swA= OFF, swB= OFF). Tune the FUNCTION GENERATOR to 1200Hz and select SINUSOIDAL output with 4 V pp. Set scope as follows: SCOPE: Timebase 2ms; Rising edge trigger on CH0; Trigger level=0V Display the output and input of the LIMITER, and observe the effect of changing the amplitude at the AMPLITUDE control of the FUNCTION GENERATOR. Make it larger and smaller. Record your findings in the form of a graph showing p-p output voltage vs p-p input voltage. You can plot your readings on the graph below. Graph 3: CLIPPER input and output readings Next we use the CLIPPER as a primitive digital detector. 32. Patch up the SIGEx model in Figure 3d (note that it is an extension of the model in Figure 1b). The LIMITER should be in the same setting as before (OFF:OFF). Display the outputs of the LIMITER and of the BLPF. Begin with the clock rate near 1.5 kHz. As before, the timebase should be adjusted to provide a useful balance between detail and range of observation. Examine the two signals and consider the possible interpretation of the output as a restored or regenerated form of the original digital sequence. Experiment 3 - Special signals – characteristics and applications © 2011 Emona Instruments 3-17 SEQUENCE SOURCE S.U.I. Figure 3c: block diagram for clipping a digital pulse sequence Figure 3d: model for block diagram of Figure 3c 33. As you gradually increase the clock frequency (as in Task 16), carefully watch for the disappearance of transitions or pulses in the CLIPPER output. When this happens, wind the frequency back slightly and determine the highest frequency that allows detection without visible errors. Compare the result with your previous findings in Task 16, i.e. without using the LIMITER. Figure 4: example of signals in & out of LIMITER 34. Compare with the results obtained in Part 1 and record your conclusions, i.e., about the practicality and usefulness of the clipper as an "interpreter" to recover the data in the distorted signal . 3-18 © 2011 Emona Instruments Experiment 3 - Special signals – characteristics and applications V1.2 Question 8 How does this setup compare to the previous findings without a LIMITER ? In the above we have used only continuous-time waveforms. Discrete-time signals and systems are introduced in Lab 4. Experiment 3 - Special signals – characteristics and applications © 2011 Emona Instruments 3-19 Tutorial questions Q1 The impulse function was described in Part 1. Explain why the step function is a better alternative in a practical context. Show how the impulse response can be obtained from the step response. Is this indirect procedure for measuring the impulse response theoretically equivalent, or does it involve an approximation? Q2 Consider a system with step response rise-time of 4 µs. What information does this provide about the impulse response? Q3 a. Consider the waveform at the yellow X output of the SEQUENCE GENERATOR (as in Part 1). Suppose the p-p voltage is 3.9 Volt and the clock is 2 kHz. What is the average power into a 1 Ohm load? b. Suppose the waveform is passed through BASEBAND LOW PASS FILTER and the p-p output amplitude is also 3.9 Volt. Is the power greater or less than at the channel input? State the reasoning (hint: consider the waveform shape required to have the average power exceed that of the waveform at the channel input). c. Consider two different sequences as above. One has N transitions per period, the other has N + 4. Explain why the number of transitions does not affect the average power for the signal format at the channel input. Is the answer the same at the output? If no, in which case will the average power be greater? Indicate why. Hint: math not required, just consider how the average is worked out. Q4 A 60 kHz sinewave is applied at one input of a MULTIPLIER, and a 59 kHz sinewave at the other input. The amplitudes are both 2 Volt p-p. Use a suitable formula to show that the MULTIPLIER output is the sum of two sinewaves. Calculate their respective frequencies. The MULTIPLIER output is fed to a system similar to BASEBAND LOWPASS FILTERS, with step response risetime 300 µs. Describe the signal at the output of this system, if any. 3-20 © 2011 Emona Instruments Experiment 3 - Special signals – characteristics and applications V1.2 Experiment 4 – Systems – Linear & Nonlinear Achievements in this experiment Understanding of the special role of sinusoids in linear systems. Knowledge and experience of testing for linearity. Preliminary discussion Lab 1 was about special signals. The aspect that was special was their use for getting characteristic information about systems. However, although the focus of that lab was on signals, a system was nevertheless needed as a vehicle for the action. In this lab the focus will be on the system, and as might be expected, it is signals that will be doing the talking. Moreover, it will emerge that the story in Lab 1 was incomplete. We will discover a signal set that is perfectly matched to a special class of systems. We get started with explorations of various linear and nonlinear systems, and look into memory effects. Next, tests for linearity are implemented. The lab concludes with a ‘lateral’ investigation of frequency response. Pre-requisite work Question 1 Write down a formula to express the square of a sinusoid in terms of a double angle argument. Question 2 What is the meaning of differential linearity ? Consider the two conditions for linearity for a system S defined by y = S(x) Scaling or homogeneity: a.y = S(a.x) Additivity: y1 + y2 = S(x1 + x2) Question 3 How would you apply these formulas in testing systems for linearity in this Lab ? How many replicas of the system are needed for the additivity test ? 4-2 © 2011 Emona Instruments Experiment 4 - Systems – Linear & Nonlinear V1.2 Equipment PC with LabVIEW Runtime Engine software appropriate for the version being used. NI ELVIS 2 or 2+ and USB cable to suit EMONA SIGEx Signal & Systems add-on board Assorted patch leads Two BNC – 2mm leads Procedure Part A – Setting up the NI ELVIS/SIGEx bundle 1. Turn off the NI ELVIS unit and its Prototyping Board switch. 2. Plug the SIGEx board into the NI ELVIS unit. Note: This may already have been done for you. 3. Connect the NI ELVIS to the PC using the USB cable. 4. Turn on the PC (if not on already) and wait for it to fully boot up (so that it’s ready to connect to external USB devices). 5. Turn on the NI ELVIS unit but not the Prototyping Board switch yet. You should observe the USB light turn on (top right corner of ELVIS unit).The PC may make a sound to indicate that the ELVIS unit has been detected if the speakers are activated. 6. Turn on the NI ELVIS Prototyping Board switch to power the SIGEx board. Check that all three power LEDs are on. If not call the instructor for assistance. 7. Launch the SIGEx Main VI. 8. When you’re asked to select a device number, enter the number that corresponds with the NI ELVIS that you’re using. 9. You’re now ready to work with the NI ELVIS/SIGEx bundle. 10. Select the EXPT 4 tab on the SIGEx SFP. Note: To stop the SIGEx VI when you’ve finished the experiment, it’s preferable to use the STOP button on the SIGEx SFP itself rather than the LabVIEW window STOP button at the top of the window. This will allow the program to conduct an orderly shutdown and close the various DAQmx channels it has opened. Experiment 4 - Systems – Linear & Nonlinear © 2011 Emona Instruments 4-3 Experiment Part 1: Getting started In this Part we have a quick look at some simple systems and check for linearity. First the LIMITER, next the RECTIFIER. S.U.I. Figure 1: block diagram for sinusoidal investigation Figure 2: patching diagram for a “clipping” system 11. Connect the FUNC OUT terminal of the FUNCTION GENERATOR to the LIMITER input. Connect CH0 to this input. Connect CH1 to the LIMITER output. The settings are as follows: FUNCTION GENERATOR: FREQUENCY=1000; AMPLITUDE: 1 V pp; SINE waveform selected LIMITER: DIP switch to OFF:OFF for “medium” clipping. Refer to SIGEx User Manual for details. SCOPE: Timebase 4ms; Rising edge trigger on CH0; Trigger level=0V 12. Adjust the amplitude of the SINE waveform from 1 v pp to around 10 V pp. Take various readings throughout this range and document in the table below. HINT: Use the cursors on the graph of TAB 4 to quickly take peak readings, then double. 4-4 © 2011 Emona Instruments Experiment 4 - Systems – Linear & Nonlinear V1.2 Table 1 Input amplitude (Vpp) LIMITER amplitude (Vpp) RECTIFIER amplitude (Vpp) Question 4 Does this system (CLIPPER) satisfy the scaling test for linearity? Show your reasoning. Figure 3: patching diagram for a “rectifying” system Experiment 4 - Systems – Linear & Nonlinear © 2011 Emona Instruments 4-5 13. Connect the FUNC OUT terminal of the FUNCTION GENERATOR to the RECTIFIER input. Connect CH0 to this input. Connect CH1 to the RECTIFIER output, as per Figure 3. The settings required are as follows: FUNCTION GENERATOR: FREQUENCY=1000; AMPLITUDE: 1 V pp; SINE waveform selected SCOPE: Timebase 4ms; Rising edge trigger on CH0; Trigger level=0V 14. Adjust the amplitude of the SINE waveform from 1 Vpp to around 6 Vpp. Take various readings throughout this range and document in the table 1 above. As the output signal appears only to be positive going, measure its positive amplitude (which is also its total peak to peak value). Show that this system satisfies the homogeneity test over part of the input range (i.e. where the range excludes the zero input point). Question 5 Does this system (RECTIFIER) satisfy the scaling test for linearity? Show your reasoning. In the above, consider the meaning and applications of the term ‘differential linearity’ (also known as 'incremental linearity'). For comparison, you will now repeat the above with an analog MULTIPLIER. Observe the effect of changing the AMPLITUDE. Record your findings concerning linearity. 15. Connect the FUNC OUT terminal of the FUNCTION GENERATOR to the MULTIPLIER inputs. Connect both inputs in parallel. Connect CH0 to this input. Connect CH1 to the MULTIPLIER output, as per Figure 4. The settings required are as follows: FUNCTION GENERATOR: FREQUENCY=1000; AMPLITUDE: 1 V pp; SINE waveform selected SCOPE: Timebase 4ms; Rising edge trigger on CH0; Trigger level=0V Figure 4-6 © 2011 Emona Instruments 4: patching diagram for a “multiplying” system Experiment 4 - Systems – Linear & Nonlinear V1.2 Table 2 Input amplitude (Vpp) MULTIPLER amplitude (Vpp) Question 6 Does this system (MULTIPLIER) satisfy the scaling test for linearity? Show your reasoning. Note that the application of the additivity test is not needed when the homogeneity test has failed. A complication with the additivity test is the need for replicas of the system under test, hence the homogeneity test is normally applied first. Unlike the BLPF channels, investigated in Lab 3, the responses of the above systems appear as effectively instantaneous, i.e. the systems are ‘memoryless’ over the time scales of interest above. However, closer examination with the scope time base in the nanosecond ranges reveals that the responses are not as ‘instantaneous’ as might seem. Thus the idea of a ‘memoryless’ system is only relative in a practical context. Part 2 – the VCO as a system In this part we explore the output-input characteristics of the VCO (voltage controlled oscillator) and apply linearity tests. Experiment 4 - Systems – Linear & Nonlinear © 2011 Emona Instruments 4-7 Figure 5: model for investigation of VCO as a system 16. Connect as shown in Figure 5. Settings are as follows: FUNCTION GENERATOR: FREQUENCY=2000 Hz; AMPLITUDE: 4 V pp; SINE waveform selected MODULATION TYPE: FM SCOPE: Timebase 4ms; Rising edge trigger on sinewave output; Trigger level=0V 17. Display both the input DC voltage and the output sinusoid. Ensure that the scope is triggering on the sinusoid signal for a stable display. 18. Observe the effect of varying the DC input voltage. Document output frequency vs input DC voltage in the table below. (The scope can be used to measure the DC voltage and frequency). Table 3 Input DC voltage (V) 4-8 © 2011 Emona Instruments VCO output frequency (Hz) Experiment 4 - Systems – Linear & Nonlinear V1.2 19. Consider whether the VCO is a linear system, ie in terms of output frequency vs input DC voltage. For this purpose should you focus on incremental frequency rather than absolute frequency ? (cf differential linearity). Question 7 Is the VCO a linear system ? Explain your reasoning. Figure 6: model for investigation of VCO as a system with rapidly “varying” input level 20. Replace the DC signal with the signal output from the MULTIPLIER, where the input to the MULTIPLIER is both the DC voltage at DAC-1 and the fixed sinewave at DAC-0. This effectively gives you amplitude control over the sinewave by using the DC voltage as the multiplication factor. Observe the effect of varying the DC input voltage on the MULTIPLIER output, as well as the VCO output. 21. Observe the VCO output. Consider possible applications (hint: synonym for ‘varying’ is ‘modulating’). View the input and output of the VCO with both scope leads. Trigger the scope on the input signal for a stable display. A note about scope triggering: As a general rule, it is best to trigger the scope on the lowest frequency signal being displayed. This causes the scope to display the slower signal with stability, and have the faster signal moving relative to that. In this case, although the two signals displayed are not synchronised, it is easy to see the influence of the lower frequency signal on the VCO output. Try both ways and see if you agree. Question 8 What applications could the VCO with varying output frequency be used for ? Experiment 4 - Systems – Linear & Nonlinear © 2011 Emona Instruments 4-9 Part 3 – a feedback system We will apply both linearity tests to a simple feedback system implemented with the LAPLACE module. First we carry out some basic exploration of the operation of the INTEGRATOR. 22. Patch up the model in Figure below. Settings are as follows: FUNCTION GENERATOR: FREQUENCY=1000 Hz; AMPLITUDE: 4 V pp; SINE waveform selected MODULATION TYPE: NONE LIMITER DIP switches: DOWN:DOWN INTEGRATOR RATE DIP switches: UP:UP SCOPE: Timebase 2ms; Rising edge trigger on CH0; Trigger level=0V Figure 7: patching model for sawtooth generation Figure 8: scope display for sawtooth generation 23. Measure the p-p amplitude of the output sawtooth waveform. Calculate the slope (slew rate) of the sawtooth and use this to write a formula for the INTEGRATOR output in terms of the input. 4-10 © 2011 Emona Instruments Experiment 4 - Systems – Linear & Nonlinear V1.2 Question 9 What is the formula for the INTEGRATOR output ? 24. Repeat this for the other three available INTEGRATOR rate settings. If a particular INTEGRATOR rate is too high, then note this. Question 10 What are the formulae for the other INTEGRATOR rate settings ? Next we apply negative feedback to the “open loop” integrator above. 25. Patch up the modules according to the figures below to add a feedback path to the system. Settings are as follows: FUNCTION GENERATOR: FREQUENCY=500 Hz; AMPLITUDE: 2 V pp; SQUARE waveform selected MODULATION TYPE: NONE INTEGRATOR RATE DIP switches: UP:UP SCOPE: Timebase 4ms; Rising edge trigger on CH0; Trigger level=0V ADDER GAINS: b1=1.0; b2= - 1.0 Figure 9: block diagram for a feedback system Experiment 4 - Systems – Linear & Nonlinear © 2011 Emona Instruments 4-11 Figure 10: patching diagram for a feedback system Ensure that you have used and set the ADDERS as per the figure and settings above. We are interested in negative feedback, hence the negative gain setting for b2. View the output and input of the INTEGRATOR as CH0 and CH1 respectively. Your display should look like Figure 11. Figure 11: example signals Observe the displayed waveforms of Fig 11 and satisfy yourself that they represent step responses (briefly display the input waveform as a reminder). Note that these responses are made up of exponential segments. Examine the waveform at the ADDER output (input to the INTEGRATOR), and confirm that it looks like the impulse response corresponding to the step response at the INTEGRATOR output. 26. On the scope, measure the time taken for the exponential curve to decay by 50% and use this to calculate the time constant. 27. Refer to your preparation work on tutorial Q1c and compare the theoretical step responses with those observed above. Question 11 Use the value of the b2 gain, and INTEGRATOR constant you measured above to determine the time constant of the exponential responses. Compare this with the value obtained from your measurement. 4-12 © 2011 Emona Instruments Experiment 4 - Systems – Linear & Nonlinear V1.2 28. Observe the effect of varying the b2 gain, and check that this is in general agreement with the predictions of the theoretical formulas. In particular, take a close look at b2 values of 0, -0.1, -0.2, ... and confirm that you can see effect addition (or subtraction) of the output from the input, as you subtly introduce feedback. 29. Explain why this feedback system is not memoryless in the time scale of our observations. Determine the location of the system memory (see Tutorial Q1d). 30. Change the input amplitude and confirm that the system satisfies the homogeneity condition for linearity. Switch the FUNCTION GENERATOR back to SINEWAVE output to demonstrate that the result is the same with a sinusoidal input. Question 12 Write a differential equation for this first-order feedback system. Assume initial conditions are zero. Show that with a sinusoidal function of time as input, the output is also sinusoidal. Show that this also happens when the input is a complex exponential. Which special property of complex exponential functions provides the key? Part 4: testing for additivity Next we test for the additivity condition. The block diagram below depicts a model for this, that requires three identical copies of the system under test ie: s(a), s(b) and s(c). Test signal x1 is a sinewave from ANALOG OUT DAC-0; x2 is a squarewave of opposite phase from ANALOG OUT DAC-1. 31. Select the appropriate signals as outputs from the ANALOG OUTPUT block by switching ON the “Part 4 Signal Select” button on TAB “Lab 4”. x 1 S(α) x 2 x 1 x 2 S( x1 + x 2 ) sum at input S(β) y S( γ) y 1 Sx 1 + S x2 2 Figure 12: test method using matched copies of the system Experiment 4 - Systems – Linear & Nonlinear © 2011 Emona Instruments 4-13 Figure 13: patching model for generating the S(x1 + x2) & Sx1 + Sx2 arrangements simultaneously We have available three INTEGRATORS which will act as our systems S(x). 32. As a first step, confirm that each S(x) is identical, by inputing the same signal into each and comparing their outputs. You can use the square signal from DAC-1 as an interesting and familiar source. Setup the INTEGRATOR RATE DIP switches as UP:UP 33. Patch up the 2 models as per the figure above. Settings are as follows: INTEGRATOR RATE: UP:UP ADDER GAINS: a0=a1=b0=b1= +1.0; a2=b2=0; SCOPE: Timebase = 4ms, Trig level = 0V 34. Focus firstly on system S(x1 + x2). View all points of the system and confirm that the signals are as expected. Figure 14: example of (x1 + x2) before and after processing by system S 35. Now view the signals of system Sx1 + Sx2 and confirm that all signals are as expected. Produce an accurate record each of the systems output waveform on the graph below. 4-14 © 2011 Emona Instruments Experiment 4 - Systems – Linear & Nonlinear V1.2 Graph 1: additivity signals Question 13 Does the outcome indicate that the linearity conditions have been met for these two test inputs? 36. Vary the gains of one system and observe the effect. Remember to ensure that gains a1=b1 and a0=b0 to maintain a consistent comparison. Question 14 Does the outcome during variation indicate that the linearity conditions are still maintained for these two test inputs? Experiment 4 - Systems – Linear & Nonlinear © 2011 Emona Instruments 4-15 Part 5 – frequency response In Lab 3 (Part 2) we found that when a sinewave of constant amplitude was applied to the input of a BBLPF channel, the output amplitude was dependent on the frequency. A sinewave was chosen for that test because we were making a comparison with the shape of the impulse response of the BBLPF, which was very similar to a sinusoidal segment. The idea of frequency response using sinewaves is well known in the audio culture, for example, as used in the testing of amplifiers, microphones, etc. . Here we ask: why have sinewaves been singled out for this -- could another kind of waveshape be used to measure frequency response, for example, a squarewave? There is a quick way to find out. S.U.I. S.U.I. Figure 15:block diagram for investigation with a squarewave and a sinewave 37. Measure the frequency response of BBLPF with a square wave. Use the set up and method in Lab 3. Use the square wave available at the FUNCTION GENERATOR block, FUNC OUT terminal, by selecting SQUAREWAVE output (this signal is a bipolar squarewave, as opposed to the TTL level squarewave available at the SYNC output). Explain your criterion for the amplitude measurement at the output (specifically, to deal with the shape changes and ringing oscillations). Enter your readings into the table below. Input frequency (Hz) 4-16 © 2011 Emona Instruments Square wave output (V) Sine wave output (V) Experiment 4 - Systems – Linear & Nonlinear V1.2 Question 15 How are you able to use the square wave for this test ? 38. Next, try with sinewaves. The measurement is very straightforward. Unlike squarewaves, the sinewaves emerge at the output with no apparent change of shape. The issue of amplitude measurement criterion does not arise. Enter your readings into the same table. Consider the possibility of other waveforms that may also have this property. Relate this to the math in Tutorial Q 1. And now, a role for sinusoids in quantifying nonlinearity. In the world of the discerning audiophile, speed of response is of paramount importance, and we have seen that this can be quantified in terms of a time domain response, and also through the medium of the sinewave frequency response. An equally essential facet of sound quality is linearity. The presence of nonlinearities in amplifiers, microphones, etc generates distortion and diminishes the listening experience. Hence it is important to have paradigms for quantifying deviation from linearity. It is interesting that the sinusoidal waveform is also a basis for nonlinearity modelling. Think about how this might be implemented. However, you will find it more rewarding to reconsider this after discovering the fertile valleys of the frequency domain, in Labs 8 & 9. The systems used so far have not included a discrete-time example. This is done in later experiments. Tutorial questions Q1 a. Write a differential equation for the first-order feedback system in Part 4. Assume initial conditions are zero. Show that with a sinusoidal function of time as input, the output is also sinusoidal. Show that this also happens when the input is a complex exponential. Which special property of complex exponential functions provides the key? b. For each of the two possible outputs, write expressions for the ratio of output to input when the input is exp(jωt). Show how this result can be used to obtain a formula for the amplitude response when the input is the real signal sin(ωt). c. Modify the differential equation in (a) to include nonzero initial conditions. Make the input zero and solve for the natural response (i.e., the homogeneous solution). Use this to obtain the step responses at each output. Apply the findings in Lab 1 to convert the step responses to impulse responses. d. Find out how to make an integrator with an operational amplifier. Experiment 4 - Systems – Linear & Nonlinear © 2011 Emona Instruments 4-17 e. Suppose that in (b) jω is replaced by the general complex variable s = σ + jω. Suggest an interpretation for s in a practical context. f. Consult your favourite reference to see how the Laplace transform is applied to solve linear differential equations with constant coefficients. Q2 What is the difference between a halfwave rectifier and a fullwave rectifier ? Show how to make a full-wave rectifier with two half-wave rectifiers. Q3 Consider a multiplier with 1.5V DC to input y. Is this system linear wrt input x? Repeat this with a 2 Volt p-p sinewave at input y. Consider this test with other waveforms at input y (for example a squarewave, a rectified sinewave). Next, apply a 2 kHz sinewave to the two inputs connected in parallel. Write an equation for the output in terms of the input. Is the scaling (homogeneity) test for linearity met? Show that the output waveform is sinusoidal. What is its frequency? Suggest an application for this system ? Q4 From the Lab, should we conclude that nonlinear systems are generally memoryless? Suggest examples to the contrary. Hint: a speed control governor in a steam engine, analogous method for amplitude compression control in audio systems. Q5 Consider a cascade of two of the first-order systems in Q 1 . The INTEGRATOR constants are τ1 and τ2 (in seconds), the feedback gains are α1 and α2, respectively. The input is sin(ωt). Write down the output/input amplitude ratio of the overall system. Plot this vs frequency (use convenient numerical values for the constants). Q6 Consider again the two first-order systems in Q 5, however this time connect them in parallel, with output 2 subtracted from output 1. Repeat Q 5 for this case. Compare the two configurations. Repeat with the outputs added and compare with the above. Q7 4-18 Consider the sawtooth waveform generated with the integrator. Draw a block diagram showing how this waveform could be used with a VCO and a scope in x-y mode to produce a rudimentary frequency response display. © 2011 Emona Instruments Experiment 4 - Systems – Linear & Nonlinear V1.2 Experiment 5 – Unraveling Convolution Achievements in this experiment Carry out a step-by-step dissection of the convolution process in a discrete-time system. Use this to discover the convolution formula. Demonstrate that convolution can be visualized as a running average of successive values of the input signal. Observe a special property applying to sinewaves. Demonstrate the operation of a filter in the time domain. Preliminary discussion For many students, the first encounter with convolution is an abstract mathematical formula in a textbook. This lab offers a more evocative experience. By tracing the passage of some basic signals through a simple linear system, you will be able to observe the underlying process in action, and, with a little arithmetic, discover a formula as it emerges from the hardware. Refresh your basic trigonometry: you will need sin(ω.t) + A.cos(ω.t + φ) expressed as a single sinusoid. If any of the modules is unfamiliar, spend a little time with the SIGEx User Manual. This will give you a headstart in setting up the lab. We patch up a delay line with two unit delays and three taps with independently adjustable gains as in Figure 1. In the first exercise you will set these gains to given values, and observe the output when the input is a single pulse (more exactly, a periodic sequence of single pulses). This is an important preliminary as it introduces the unit pulse response. + OUTPUT INPUT b2 b1 b0 UNIT DELAY UNIT DELAY Figure 1a: general block diagram of the system Next, you will observe the output when a pair of adjacent pulses is used as input. This near trivial example provides us with a springboard to the general case. It will demonstrate how convolution operates as an overlapping and superposition of unit pulse responses. A second more general input sequence is then used to reveal a deeper insight and to provide a vehicle for setting up the key formulas. In the remainder of the lab we use sinewaves as inputs. This takes us to the rediscovery of the special role of sinusoids in linear time-invariant systems. In the final exercise we carry out and unravel a disappearing act. It should take you about 40 minutes to complete this experiment. 5-2 © 2011 Emona Instruments Experiment 5 – Unraveling Convolution V1.2 Pre-requisites: Familiarization with the SIGEx conventions and general module usage. A brief review of the operation of the S/H & UNIT DELAY module from SIGEx User Manual. No theory required. Equipment PC with LabVIEW Runtime Engine software appropriate for the version being used. NI ELVIS 2 or 2+ and USB cable to suit EMONA SIGEx Signal & Systems add-on board Assorted patch leads Two BNC – 2mm leads Procedure Part A – Setting up the NI ELVIS/SIGEx bundle 1. Turn off the NI ELVIS unit and its Prototyping Board switch. 2. Plug the SIGEx board into the NI ELVIS unit. Note: This may already have been done for you. 3. Connect the NI ELVIS to the PC using the USB cable. 4. Turn on the PC (if not on already) and wait for it to fully boot up (so that it’s ready to connect to external USB devices). 5. Turn on the NI ELVIS unit but not the Prototyping Board switch yet. You should observe the USB light turn on (top right corner of ELVIS unit).The PC may make a sound to indicate that the ELVIS unit has been detected if the speakers are activated. 6. Turn on the NI ELVIS Prototyping Board switch to power the SIGEx board. Check that all three power LEDs are on. If not call the instructor for assistance. 7. Launch the SIGEx Main VI. 8. When you’re asked to select a device number, enter the number that corresponds with the NI ELVIS that you’re using. 9. You’re now ready to work with the NI ELVIS/SIGEx bundle. 10. Select the EXPT 5 tab on the SIGEx SFP. Note: To stop the SIGEx VI when you’ve finished the experiment, it’s preferable to use the STOP button on the SIGEx SFP itself rather than the LabVIEW window STOP button at the top of the window. This will allow the program to conduct an orderly shutdown and close the various DAQmx channels it has opened. Experiment 5 – Unraveling Convolution © 2011 Emona Instruments 5-3 Experiment Part 1 – Setting up 11. Patch up the model as shown in Figure 2. Settings are as follows: PULSE GENERATOR: FREQUENCY=1000Hz; DUTY CYCLE: 0.5 (50%) SEQUENCE GENERATOR: DIPS UP/UP SCOPE: Timebase 10ms; Rising edge trigger on CH0; Trigger level=1V + OUTPUT INPUT b2 b1 b0 UNIT DELAY UNIT DELAY Figure 1b: general block diagram of the system Figure 2: patching diagram of the system in Figure 1 12. The required signal appears at the SEQUENCE GENERATOR SYNC output as a 5V signal and needs to be reduced in amplitude using the available a0 GAIN function . Using the scope, check that you have a periodic sequence of a single 1V pulse in a frame of 31 pulse periods. Confirm the pulse width is 1ms. Adjust the a0 gain value to have a pulse amplitude of 1V precisely. Adjust the SCOPE trig level to suit. 5-4 © 2011 Emona Instruments Experiment 5 – Unraveling Convolution V1.2 Note that as the incoming pulse is being clocked by the same clock as the unit delay blocks, the pulse is already aligned with the unit delay clock and is thus already a discrete signal. For this reason it can be input directly into the unit delay without use of the S/H block. Part 2 – unit pulse response Before proceeding with the examination of the system response, the delay line “tap” gains must be set. For the first case we shall use b0 = 0.3, b1 = 0.5 and b2 = − 0.2 (see Figure 1). These settings have been chosen arbitrarily as interesting and varied values for this exercise. Adjust each gain in turn on the SFP and use the scope to confirm your settings. Question 1 Describe a procedure for confirming the GAIN at each tap ? Question 2 Display the delay line input signal (i.e. at the first z-1 block input) and the ADDER output signal. Measure and record the amplitude of each pulse in the output sequence. Note that the system output is a sequence of three contiguous pulses with amplitudes in the same ratio as the adder input gains. Could this have been predicted from Figure 1? Indeed, since the single pulse at the input is generating delayed and scaled replicas as it travels down the delay line. These are then summed in the adder. Thus we have the system’s response to an isolated pulse. From this we can define the unit pulse response h(n) as the response when the amplitude of the input pulse is unity. From your measurements, show that the unit pulse h(0) = b0 , h(1) = b1 , h(2) = b2 in this example. The presence of delayed energy is normally expected in real-life systems, whether electrical or mechanical. For example, due to inertia in mechanical systems. Similarly in electric circuits, we have energy storage effects in reactive components such as capacitors and inductors. Experiment 5 – Unraveling Convolution © 2011 Emona Instruments 5-5 Part 3 – The superposition sum 13. Adjust the SEQUENCE GENERATOR DIP switches to position UP:DOWN to select the sequence of two contiguous pulses. Using the same gain settings as in Part 2, observe the output signal. Note that it consists of four nonzero pulses per frame. Measure and record the amplitude of each pulse. 14. Verify that the output sequence is simply the sum of two offset unit pulse responses. Use the graph below to show your computation. Graph 1: unit pulse pair summation Question 3 What is meant by “superposition”. Discuss how this exercise above relates to superposition and the “additivity” principle. 5-6 © 2011 Emona Instruments Experiment 5 – Unraveling Convolution V1.2 Question 4 What do you expect to see if this exercise were expanded to two or more contiguous pulses ? Explain. Part 4: rectified sinewave at input In this exercise the input is a little more interesting than in Part 3: a sequence of three or four pulses of different amplitude. We obtain the source of this signal from the ANALOG OUT DAC-0. We then pass this analog signal to the SAMPLE/HOLD block to be sampled and this becomes our discrete sequence of pulses. Note that the PULSE GENERATOR and DAC signal generator share the same internal clock and hence no slippage occurs in the scope displays. Note that although the signal is sampled and becomes “discrete” it has not become a “digital” signal. This is an important distinction. Rather it now exists as sequential discrete samples of the original signal. More about sampling and its implications in several later experiments. Settings are as follows: PULSE GENERATOR: FREQUENCY=800Hz; DUTY CYCLE: 0.5 (50%) SCOPE: Timebase 10ms; Rising edge trigger on CH0; Trigger level=1V Confirm that the sinewave from the DAC-0 is 100Hz, 2V peak, before entering the RECTIFIER. We will treat the sinewave as a continuous signal and ignore the very small steps present as these have no consequence to our procedure. Question 5 Note the amplitude of the half wave rectified sine and explain why its amplitude is reduced relative to the input ? Experiment 5 – Unraveling Convolution © 2011 Emona Instruments 5-7 Figure 3: Block diagram of system with series of pulses as input. Figure 4: SIGEx patching model for rectified sinewave input 5-8 © 2011 Emona Instruments Experiment 5 – Unraveling Convolution V1.2 15. Maintaining the same values for the b gains as in Part 1 (i.e. b0 = 0.3, b1 = 0.5 and b2 = 0.2), display the input (i.e., SAMPLE-HOLD output as shown in Figure 5a) and output signals. Sketch the original half-rectified sinusoid and discrete output from the SAMPLE/HOLD in the graph below. Graph 2: inputs and sampled outputs Confirm that there are 8 samples of each half wave sine input. This is expected as the sampling clock is 800Hz and the input sinewave is 100 Hz. Note there are four nonzero pulses in the delay line input sequence and six in the summer output. The reason for this will emerge as we proceed. Again, we will carry out a deconstruction of the output signal in terms of the time offset contributions, i.e. we will trace the output pulse amplitudes in terms of the input values. We could use the same method as in Part 3, however, there is an interesting alternative. We will separately observe and compare the three individual contributions into the output ADDER, i.e. the signals added through gains b0, b1 and b2 in turn. Examples of these signals are shown in Figure 5b below. Experiment 5 – Unraveling Convolution © 2011 Emona Instruments 5-9 Figure 5a: example input signal and 4-level sampled signal Figure 5b: example individual bo, b1 & b2 inputs to adding junction 16. We begin with the contribution through b2. Temporarily disconnect the leads corresponding to inputs b0 and b1. Observe and record the input and output signals in the graph above. Confirm for yourself that this result is as expected. View the sampled input on one scope channel and the individual output on the other scope channel. 17. Now repeat for the b1 and b0 contributions. Only the outputs need be recorded since the same input is used. Again, verify that the results are as expected. When completed, you will have three scaled replicas of the input with time offsets. 18. For each time slot, sum the contributions of the three output records and plot the result. Verify that this agrees with the output signal produced when the three leads are reconnected to the adder inputs. Question 6 How does this process relate to the principle of “superposition” ? In summary, we have just passed a sequence of discrete values (our sampled input) through a system with a particular response (a series of unit delays with multiplying taps) to produce an accumulation ( the adder) of discrete product terms which are then output. Each one of these individual contributions is the scaled and shifted version of the unit pulse response of this system. Another way of thinking about this system as as it being a series of weighting coefficients. Now we need to think about representing this process mathematically. An obvious way to start is to write a separate formula for the six nonzero output pulse amplitudes . Let us name them y(1), y(2), …, y(6). 5-10 © 2011 Emona Instruments Experiment 5 – Unraveling Convolution V1.2 19. Label them on your sketch above. Pay attention to the orientation you use. Each consists of a sum of three products, i.e., of a tap gain b0, b1, or b2 and an input pulse amplitude. The input sequence has eight elements (as previously observed, four of these are zero). Label these x(1), x(2), …, x(8) (you should find it convenient to choose x(1) = x(2) = x(7) = x(8) = 0). 20. Label these on your sketch above. Numeric indexing is useful as an aid in looking for the general pattern. The next step is to use symbolic indexing so that the set of formulas can be condensed into one. Here are some of the formulas as they appear with numeric indexing: y(3) = b0 .x(3) + b1 .x(2) + b2 .x(1) y(4) = b0 .x(4) + b1 .x(3) + b2 .x(2) y(5) = b0 .x(5) + b1 .x(4) + b2 .x(3) y(6) = b0 .x(6) + b1 .x(5) + b2 .x(4) Question 7 Write down the formula for y(2) and y(1) ? Discuss any unexpected differences . The general pattern is readily apparent. With symbolic indexing, we can replace these with the single formula y(n) = b0 .x(n) + b1 .x(n -1) + b2 .x(n - 2) where n represents the position in the sequence as a discrete time index. In Part 2, we found that the unit pulse response h(k) for this system is h(0) = b0 , h(1) = b1 , h(2) = b2 . Hence we can express the formula for y(n) as y(n) = h(0) .x(n) + h(1).x(n - 1) + h(2).x(n - 2) i.e., y(n) = sum over range of k {h(k).x(n - k)} This simple formula is known as convolution. Experiment 5 – Unraveling Convolution © 2011 Emona Instruments 5-11 For the discrete signal case we have implemented it is also known as the convolution sum or the superposition sum. It can also be expressed in this more compact form: y(n) = y(n) = x(n) * h(n) where * represents the “convolution” operator. It provides a neat way of packaging the procedures you carried out in your investigation, and it allows the range of k to be extended to any desired value. It is the mathematical representation of the interaction between the input sequence and the unit pulse response of the system. Note in particular the term x(n-k). Since we are computing in terms of k, this is a time reversed version of x(k). This issue is put into context further in a later experiment introducing correlation, an operation which has a similar looking equation. This subject is covered in detail in the text by Oppenheimer p90 (see Reference section for details) Question 8 Explain why this term is reversed and what does this mean ? For the continuous signal case, the summation is achieved using integration and is known as the convolution integral or the superposition integral. This topic is covered in detail in many texts including Lathi and Oppenheimer. (see Reference section for details) In brief, the convolution integral for continuous signals comes about by increasing the number of discrete samples whilst reducing their width to a limit of 0, such that the sum of many products can be represented by the integration of the product. Its equation is y(t) = In the above exercise, we obtained the result by means of a superposition of dissected parts of the unit pulse response. In Part 3 we also used superposition; however, it did not involve breaking up the unit pulse response. This method was easier to apply for that case because the input sequence had only two pulses. Compare the two methods when used with the input in Part 4 (do this with the help of sketch graphs as before). Consider possible advantages of one over the other as a vehicle for deriving the convolution formula. 21. Repeat this process with a new system response. Let each tap be equal to 0.333 ie: b0=b1=b2=0.333. 5-12 © 2011 Emona Instruments Experiment 5 – Unraveling Convolution V1.2 Question 9 What is a common label for this response ? Part 5: sinewave input Up to this point we have used relatively short input sequences. This made it easy to trace the passage of the pulses through the system since output segments remained distinct and could be readily referenced to the corresponding input segment. However, we need to consider whether the formula that we obtained on this basis is also valid in the more general and usual situation when the input signal is an ongoing stream without breaks. For this purpose we will go over the steps in Part 4 using a sinewave as input. This means there is no "natural" reference marker, hence you will need to designate one. Nevertheless, keeping track of time points will be straightforward since the signal is periodic and the number of samples per period is relatively small. 22. We use the setup in Part 4, and re-use “full sinewave” output at DAC-0 by bypassing the RECTIFIER. As before, since the sinewave frequency is a submultiple of the PULSE GENERATOR clock, no slippage occurs in the scope displays. 23. Proceed as in Part 4, connecting only one of the three adder inputs. As in Part 4, observe and record each of the separate output sequences for each input in turn. As you would expect, these are scaled and delayed replicas of the input, i.e. they are sampled sinewaves. Carry out spot checks to verify that amplitude and phase relative to the input are correct. (Reminder, since there are eight samples per period, the phase shift corresponding to a unit delay is 45 degrees.) Experiment 5 – Unraveling Convolution © 2011 Emona Instruments 5-13 24. For each time slot, add up the contributions of the three output records obtained above and plot the result. Verify that this agrees with the output signal produced when all the input leads are reconnected to the adder. Graph 3: sinewave input signals Now we are ready to revisit the formula obtained in Part 4. Proceed as before and show that the formula remains valid for this case. Question 10 Show that the formula remains valid. This completes the basics of the convolution formula. 5-14 © 2011 Emona Instruments Experiment 5 – Unraveling Convolution V1.2 In the next task we take a closer look at the output signal obtained in Part 5, and show that it is a sampled sinewave. This is a discrete-time example of the investigation in Lab 4, where we discovered that when the input of a linear system is sinusoidal, the output will also be sinusoidal. 25. Confirm that the eight pulses making up one period of the output sequence represent samples of a sinewave. A straightforward method is to exploit the sum of squares identity. Since there are eight samples per period, you can match pairs of samples that are 90 degrees apart (how many pairs can you find?). Note that knowledge of the peak amplitude is not essential for this (all that is needed is to show that the sum of the squares is the same for each pair). Question 11 Show your working for the sum of squares analysis ? 26. Use the FUNCTION GENERATOR tuned to 100 Hz to provide the alternative unsynchronized sinewave input. Set it to an amplitude of 2Vpeak (4V pp). The resulting slippage effectively produces an interpolation of the samples -- a useful exploitation of something that is usually unwanted! Now that we have a simple way of displaying the input and output sinewaves, an interesting additional item to examine is the theoretical verification of the measured output/input amplitude ratio and phase shift. The peak values are clearly apparent, so the amplitude ratio measurement is straightforward. Similarly, the now discernible zero crossings can be used for the phase shift measurement. The math for the theoretical verification is done by means of the application of the formula for reducing the sum of sinusoids . In the next Part we investigate an example of effects that can be obtained by means of suitably chosen values for the tap gains. Experiment 5 – Unraveling Convolution © 2011 Emona Instruments 5-15 Part 6: mystery application Here we explore a special application of convolution. The setup is the same as for Part 5, except for new tap gains in the delay line. Two sets will be tested. The first is b0 = 0.3 , b1 = 0.424 , b2 = 0.3 The second set is b0 = -0.3 , b1 = 0.424 , b2 = -0.3 27. When the tap gains have been adjusted to the first set of values,( b0 = 0.3 , b1 = 0.424 , b2 = 0.3), display the output, and measure the amplitude and phase relative to the input as in Part 5. Confirm that this is in agreement with theory. 28. Alter the tap values to the second set of values (b0 = -0.3 , b1 = 0.424 , b2 = -0.3) and repeat the measurements. Is the outcome predicted by theory ? 29. Vary the frequency of the sinewave over a suitable range to demonstrate that sinewave inputs with frequencies near 100 Hz are heavily attenuated. Question 12 Why is the outcome obtained above described as filtering? In other labs you will discover how to choose the tap gains to design different kinds of responses versus frequency. 5-16 © 2011 Emona Instruments Experiment 5 – Unraveling Convolution V1.2 Tutorial questions Q1 Look up your textbook to find out the name given to systems that have the structure in Figure 1, i.e. without feedback. Consider an alternative discrete-time system that has a single delay element with feedback (refer to your textbook if needed). Show how to apply the convolution formula in this case. Q2 Consider the condition(s) required to avoid infinite output values in applications where the unit pulse response is not time limited. Show to avoid an unstable output in the feedback system in Q1. Q3 Consider a process that consists of taking a running average of a data sequence, such as atmospheric pressure. Suppose we do this by taking the sum of 50% of the middle value, and 25% of the preceding and following values. Can this process be described as convolution? If so, write down the unit pulse response. Q4 Using integration instead of discrete summation, write down a continuous-time version of the convolution formula in terms of the system impulse response. Experiment 5 – Unraveling Convolution © 2011 Emona Instruments 5-17 5-18 © 2011 Emona Instruments Experiment 5 – Unraveling Convolution V1.2 Experiment 6 – Integration, convolution, correlation and matched filters Achievements in this experiment You will be able to intuitively visualize the processes of integration, convolution, correlation and “matched filters”. You will appreciate the similarities and differences between these processes. You will see them in action with real signals in the time domain and understand their use in practical applications. You will learn another Greek word. Preliminary discussion Any two signals may differ in a number of ways. They may have different amplitude distributions, mean values, autocorrelation functions, variances etc. During transmission and may have undergone amplitude variation, bandwidth limiting and phase delay effects. At the receiver is useful to apply and processes to recover the transmitted information from the received signal and to maximise the SNR of the received signal. Some of the tools we have at our disposal are processes such as integration, correlation, decision point timing and thresholding. All of these processes have the equivalent processes in the frequency domain, however in this experiment we will concentrate on time domain effects. Figure 1: SIGEx SFP screenshot with TAB 6 selected 6-2 © 2011 Emona Instruments Experiment 6- Integration, convolution, correlation V1.2 Pre-requisite work Question 1 For both a maximal length PRBS, of 31 and 63 bit length, calculate the ACF function values for all possible positions. Question 2 Calculate the sequence from a 5 bit LFSR using feedback taps 5 & 3. Question 3 (a) For the set up in Fig11, write down an expression for x(t) in terms of the input y(t) and the S.U.I. impulse response h(t). (b) Write down an expression for the CCF of x and y, and substitute the expression for x from (a). (c) Demonstrate that the result in (b) can be reduced to the convolution of h(t) and the ACF of the input. (d) Show that if the ACF of y is an impulse function, the output of the cross-correlator gives h(t) (with a scaling factor). (e) Demonstrate that if the input is white noise the ACF is an impulse Question 4 (a) In the term "matched filter" what are the items that are matched? (b) What is the role of the MF in a digital communication receiver? (c) describe the operation of the "integrate & dump" process in a digital communication receiver (d) explain why the I&D receiver is effectively a filter with a square pulse as its impulse Experiment 6- Integration, convolution, correlation © 2011 Emona Instruments 6-3 response (e) extend (d) to explain why the I&D receiver is the matched filter for square pulseform data sequences in additive white noise 6-4 © 2011 Emona Instruments Experiment 6- Integration, convolution, correlation V1.2 Equipment PC with LabVIEW Runtime Engine software appropriate for the version being used. NI ELVIS 2 or 2+ and USB cable to suit EMONA SIGEx Signal & Systems add-on board Assorted patch leads Two BNC – 2mm leads Procedure Part A – Setting up the NI ELVIS/SIGEx bundle 1. Turn off the NI ELVIS unit and its Prototyping Board switch. 2. Plug the SIGEx board into the NI ELVIS unit. Note: This may already have been done for you. 3. Connect the NI ELVIS to the PC using the USB cable. 4. Turn on the PC (if not on already) and wait for it to fully boot up (so that it’s ready to connect to external USB devices). 5. Turn on the NI ELVIS unit but not the Prototyping Board switch yet. You should observe the USB light turn on (top right corner of ELVIS unit).The PC may make a sound to indicate that the ELVIS unit has been detected if the speakers are activated. 6. Turn on the NI ELVIS Prototyping Board switch to power the SIGEx board. Check that all three power LEDs are on. If not call the instructor for assistance. 7. Launch the SIGEx Main VI. 8. When you’re asked to select a device number, enter the number that corresponds with the NI ELVIS that you’re using. 9. You’re now ready to work with the NI ELVIS/SIGEx bundle. 10. Select the EXPT 6 tab on the SIGEx SFP. Note: To stop the SIGEx VI when you’ve finished the experiment, it’s preferable to use the STOP button on the SIGEx SFP itself rather than the LabVIEW window STOP button at the top of the window. This will allow the program to conduct an orderly shutdown and close the various DAQmx channels it has opened. Ask the instructor to check your work before continuing. Experiment 6- Integration, convolution, correlation © 2011 Emona Instruments 6-5 Experiment This experiment consists of 5 parts. These parts can be presented separately or in combination depending on the lab time available or curriculum preferences. Part 1: Auto-correlation & Cross-correlation of PRBS sequences A PN or PRBS sequence, known as pseudo-noise sequence or Pseudo Random Bit Sequence, is a periodic digital sequence with well-known and defined sequence length. Maximal length sequences are simple to generate and three of such sequences are available at the SEQUENCE GENERATOR module. Refer to the User Manual for specific details. We will be mostly using a bipolar version of the PRBS. Rather than being a 5V TTL level data stream, it will be a +/- 2V data stream. This lends itself better to analog processing and is the same spectrally except for the lack of a DC component. In this part of the experiment we wish to compare a sequence with itself, and with delayed versions of itself. This process is known as an auto-correlation, meaning a correlation or comparison, with itself (from the Greek word “autos” meaning “self”). As shown in Figure 3, to effect the comparison in an analog manner, we will input the same signal into both inputs of the “correlator”. We will then multiply the incoming signals by each other and then integrate over the sequence period. If any part of a signal is the same the other, then the product will be maximum. Any differences between the incoming signals will result in a smaller signal. By detecting the maximum product point we can determine the instant at which the sequences are most alike. The signal output by the correlator is in this case known as the auto-correlation function (ACF). It is a function of the delay index, or “lag” between inputs. Another important point is that the comparison is carried out over the entire period of the signal, which in this case is the entire period of the sequence. Remember that these PRBS sequences are repetitive. Figure 2: correlator operation diagram 6-6 © 2011 Emona Instruments Experiment 6- Integration, convolution, correlation V1.2 In Figure 2 is sketched the operation of the implemented “correlator” for two cases. On the left is the condition where the two inputs are aligned. On the right is the case where the two inputs are not aligned, even though it is the same bit sequence. It is easy to see how the combination of the MULTIPLER and INTEGRATE & DUMP modules are easily able to discern between these two conditions. The final “ACF output value” is an indication of the level of similarity between the two inputs. 11. To implement this suggested methodology, patch together the modules as shown in Figure . Figure 3: block diagram for ACF of SG PRBS sequence. DELAY = n/fclk; n=0,1,2 or 3. Figure 4: patching diagram for ACF of PRBS sequence Settings are as follows: PULSE GENERATOR: Frequency=3000 Hz; DUTY CYCLE=0.5 (50%) SCOPE: Timebase 40ms; Rising edge trigger on CH0; Trigger level=0V SEQUENCE GENERATOR: DIPS set to UP:UP (short sequence) 12. Confirm for yourself that this signal at points B,C & D are delayed versions of the original signal from point A using the scope. Experiment 6- Integration, convolution, correlation © 2011 Emona Instruments 6-7 13. The reference input is connected to be MULTIPLIER input X DC. The input to be compared is input to the MULTIPLIER input Y DC. Confirm that the lead from Y DC is currently connected to the reference input X DC at terminal A. We will now compare the original sequence with itself. 14. View the output of the MULTIPLIER, kXY, and confirm that it is a constant DC level. Question 5 What voltage is the output of the MULTIPLIER ? Explain why this is so 15. View the INTEGRATE & DUMP output and confirm that it is ramping up until reaching saturation as expected. The INTEGRATE & HOLD output will hold the maximum voltage reached which is the voltage at saturation. Note that the INTEGRATE & DUMP module is a clocked module and resets its output ie: dumps its output at the end of every clock period. In this setup we are clocking this module with the SYNC pulse from the SEQUENCE GENERATOR which occurs at the beginning of the sequence, and hence has a period equal to the length of the sequence. 16. Estimate the actual voltage that the ramp would have reached if the module had not saturate. This is easily done by calculating the rate of the ramp in V/sec and multiplying by the period of the integration. Question 6 What voltage would the ramp have reached if it had not saturated ? This voltage represents the degree of similarity between the two inputs to the MULTIPLIER module. As you would expect it is at a maximum as the inputs are identical and aligned. 17. Now to compare with a non-identical sequence we delay the original sequence by several bit periods and repeat the correlation. Move the lead connected to Y DC to terminal B. NOTE: although we are comparing the SAME sequence against itself, it is no longer aligned (ie: bit0 versus bit0) and so at various bit positions it will differ. 6-8 © 2011 Emona Instruments Experiment 6- Integration, convolution, correlation V1.2 Figure 5: examples of I&D, I&H, and CLK signals during autocorrelation, at various instants 18. View the output I&D as well as input IN. Confirm that the output I & D is no longer ramping to saturation but is varying in both positive and negative direction. This is expected as the signal from the MULTIPLIER is no longer a DC voltage but is a varying bipolar signal. 19. Measure the voltage at output I & H. This is the held voltage following integration at the end of the clock period. And it is the same for each period as the sequences are repetitive. Question 7 What voltage is at the I & H output ? 20. Move the flying lead connected to Y DC to terminals C & D, and note the held voltage alongside the voltage when the lead was at terminal B. It is safe to assume that the held voltage will be more or less the same for the remaining other delayed bit positions. Refer to the “correlator operation” diagram above if this is not clear. Experiment 6- Integration, convolution, correlation © 2011 Emona Instruments 6-9 21. Sketch these held voltages versus the delay index “n” with no delay being n=0 . Remember that there are 31 possible positions . You will currently be plotting readings for only 4 positions. Graph 1: Plot of I & H voltages vs. delay position n The plot you have just sketched is a portion of what is known as the autocorrelation function (ACF) of that particular sequence. It is normally calculated using the following equation: rxx(߬) = Question 8 How well do these results correspond with your theoretical expectations from the pre-lab preparation work ? The purpose of this exercise was to show you how these equations can be manifested as real signals. An ACF will show the degree of uniqueness of a particular signal, and degree of similarity, which is minimal when dealing with such MLS sequences used for coding and encryption purposes. 6-10 © 2011 Emona Instruments Experiment 6- Integration, convolution, correlation V1.2 22. Repeat these steps and determine the ACF for the 63 bit sequence output from SEQUENCE GENERATOR when the DIPs switches are set to UP:DOWN. This is a maximal length sequence also. 23. Sketch this ACF on the same graph as for the previous results. Question 9 How well do these results correspond with your theoretical expectations ? 24. Measure and plot the ACF for the sequence from the SEQUENCE GENERATOR for DIP switch position DOWN:UP. Question 10 Based on your measured ACF, what can you say about this sequence ? 25. Set the SEQUENCE GENERATOR back to DIP switch position UP:UP and change the patching according to figure . Figure 6: patching for the ACF of PRBS sequence, with DAC-based PRBS 26. On TAB 6, select radio button “SG PRBS”. An exact copy of the 31-bit PRBS output from the SEQUENCE GENERATOR is available at DAC-0. This sequence is generated by LabVIEW and so is the clock signal which is output from DAC-1. As well, from the TAB 6 of the SIGEx Experiment 6- Integration, convolution, correlation © 2011 Emona Instruments 6-11 SFP you can vary the delay of this output sequence from 0 to 30 bit periods. This will allow you to take readings for the entire ACF. 27. The clock signal provided from DAC-1 is 3.3kHz. This is similar to the previous clock rate used. View the SYNC signal from SEQUENCE GENERATOR on CH1, and the INTEGRATE AND DUMP output. Confirm that this signal as stable and that the product of the MULTIPLIER module is being integrated. You may need to stop and restart the SFP to initialise this mode. 28. Vary the delay index “n” on the SFP TAB 6, and observed the change in the integration. As you vary this control you will observe in the ANALOG OUT viewer window, which displays the output signals DAC-1 & DAC-0, that the sequence is shifted by the number of bits selected by control “n”. In this exercise you are able to shift one of the sequences over the complete range of possible positions, that is from 0 to 31 bits. Switch Y-AUTOSCALE off for a stable display. 29. View both the INTEGRATE AND DUMP output as well as the INTEGRATE AND HOLD output with the scope. As you vary the delay index “n” from 0 to 30, ie: over 31 bits, note the output level from the INTEGRATE AND HOLD output and plot this value versus the delay index on the graph used in the previous exercise. Question 11 What observations can you make about this signal from its ACF ? Part 2: Cross-correlation function (CCF) of PRBS sequences Now that you are familiar with a methodology for correlating sequences, it will be interesting to compare two different sequences. The same methodology is used, except given that we know the sequences are different, we will expect there to be multiple smaller correlation points and no one single major similarity. However, the cross-correlation process will give us this information in an objective manner. The sequence from the SEQUENCE GENERATOR when DIPs are in the UP:UP position is as we know from above, a Maximal Length Sequence (MLS) of 31 bits in length, generated using a Linear Feedback Shift Register (LFSR) with 5 registers, and using taps 5 & 3. There are a few other tap settings which will create a MLS from a 5 register LFSR, and the signal output from ANALOG OUTPUT: DAC-0 is generated using taps 5 & 2. In this exercise you will compare our reference sequence from the SEQUENCE GENERATOR and this new sequence and plot the cross-correlation function. For two signals, x(t) and y(t), the cross-correlation function for a time limited pulse is : rxy(߬) = 6-12 © 2011 Emona Instruments Experiment 6- Integration, convolution, correlation V1.2 30. Patch together the modules as per the figure below. Notice that whilst it is essentially the same, the source of the bit clock is from the DAC-1 output. The ANALOG OUTPUT module is providing the “master clock” for both itself and the SEQUENCE GENERATOR. In this way we are guaranteed that both sequences bit output transitions are aligned. As well, the SYNC pulse which occurs once every 31 bits is output from the SEQUENCE GENERATOR and provides the integrate period clock for the INTEGRATE AND DUMP module. Figure 7: block diagram for cross-correlation of differing PRBS Figure 8: patching diagram, for cross-correlation of differing PRBS Settings are as follows: SCOPE: Timebase 40ms; Rising edge trigger on CH1; Trigger level=1V SEQUENCE GENERATOR: DIPS set to UP:UP (short sequence) 31. The clock signal provided from DAC-0 is 3.3kHz. This is similar to the previous clock rate used. View the SYNC signal from SEQUENCE GENERATOR on CH1, and the INTEGRATE AND DUMP Output. Confirm that this signal as stable and that the product of the MULTIPLIER module is being integrated. Experiment 6- Integration, convolution, correlation © 2011 Emona Instruments 6-13 32. Vary the numeric control “n” on the SFP TAB 6, and observe the change in the integration. As you vary this control you will observe in the ANALOG OUT viewer window, which displays the output signals DAC-1 & DAC-0, that the sequence is shifted by the number of bits selected by control “n”. In this exercise you are able to shift one of the sequences over the complete range of possible positions, that is from 0 to 31 bits. 33. View both the INTEGRATE AND DUMP output as well as the INTEGRATE AND HOLD output with the scope. As you vary the shift index “n” from 0 to 30, that is 31 bits, note the output level from the INTEGRATE AND HOLD output and plot this value versus the shift index on the graph used in the previous exercise. Question 12 What observations can you make from this cross-correlation about the nature of the two sequences ? Question 13 Write down the 31-bit pattern for both PRBS sequences here. Note also the number of bit pattern “runs” ? Why is the pattern “00000” not present ? 6-14 © 2011 Emona Instruments Experiment 6- Integration, convolution, correlation V1.2 Part 3: Auto-correlation & matched filters 34. Select the radio button “exponential pulse”, which will output an exponential pulse at DAC-1 and a time-shiftable copy at DAC-0. The time-shift is controlled by the DELAY INDEX control which varies from 0-100 for one complete period. Stop and restart the SFP to initialise after selecting. 35. View this pulse and sketch at on a graph below. Measure and document the time constant and peak voltage on your sketch. NB: time constant is time to decay to 36% (1/e) of initial value. Graph 2: using exponential pulses 36. View both outputs from the ANALOG OUT block, DAC-0 and DAC-1, and confirm that you are able to delay them relative to each other by varying the delay index “n” on the TAB 6 of the SFP. You can also use the ANALOG VIEWER window to view this. Experiment 6- Integration, convolution, correlation © 2011 Emona Instruments 6-15 Figure 9 : Patching for ACF of exponential pulses 37. Patch together the experiment as per Figure 9. Vary the delay index control “n” over its full range (0-100) and plot the ACF on the graph above as previous sections. For convenience, take a reading every 10 index points. The output signal you have just plotted will be the auto-correlation function (ACF) for the exponential pulse. Question 14 How could you describe this function ? 38. Refresh your memory about the impulse response of the RC NETWORK block and sketch this impulse response in the graph above. REMINDER: To measure the impulse response of the RC NETWORK simply input a narrow pulse from the PULSE GENERATOR into the RC network and measure its output response. Set the PULSE GENERATOR to FREQUENCY = 100 Hz, DUTY CYCLE = 0.02 (2%). If the signal is applied to a system, and that signal is a time-reversed version of the impulse response of a system, several interesting observations can be made. Firstly, let the system be the RC NETWORK, which has an impulse response shaped like a decaying exponential pulse. Let us name it, h(t). Secondly, if the signal to be applied is a time-reversed version of that response, then it will look like a rising exponential pulse, and let us name it x(t). 6-16 © 2011 Emona Instruments Experiment 6- Integration, convolution, correlation V1.2 Then, the output of the system, y(t), will be the convolution of the input with the impulse response. Expressed mathematically: y(t) = x(t)*h(t) :convolution y(߬) = ∫x(t).h(߬-t) dt Since h(t) = x(-t) y(߬) = ∫x(t).x(t + ߬) dt y(t) is the same as the auto-correlation (ACF) of the input x(t). As well, when a signal is input to a system whose impulse response is equal to a time-reversed version of the input, then the system is called a “ matched filter”. Called this simply because it's characteristic response is “matched” to the input waveform. A “matched filter” is the optimum filter for the input waveform to which it is matched, in order to maximise the SNR at the receiver. More about that later in this experiment. What is of interest at this point is the observation that passing a signal through its “matched” filter results in an output which is equal to the autocorrelation of the input signal. So we can see that autocorrelation and convolution involving matched filters are related. 39. Patch up the experiment in figure 10, and plot the output waveform on a graph above. Note that in this step there is no shifting of static signal, but that this signal simply passes through the system, RC NETWORK block, and is acted upon, or modified, by the system according to its characteristic response. That interaction is what we call “convolution” . (This example is covered in a pre-lab preparation question of Experiment 10.) Figure 10 : Patching diagram for inputting “shaped” pulse into its “matched filter” So far in this experiment you have encountered the implementation of two similar equations. The one for convolution, with the time-reversed component, and one for correlation, with no time-reversal. They have both involved integration over a period of time, T, and because we are working with time-limited single pulses we can restrict the integration to a single complete period of the pulse or sequence, rather than the general form of the equation where the integration is carried out over the time period -∞ < t +∞ . Experiment 6- Integration, convolution, correlation © 2011 Emona Instruments 6-17 Part 4: Determining impulse response using input/output correlation By now you should be starting to get a feeling for the relationship between input, output and the system response. It is important to know the characteristic response of the system in order to be able to effectively pass information through that system. In this part of the experiment we will explore a system’s response by probing it with random noise and seeing what the correlation between its input and output waveforms can tell us about this system. Remember that when we probe a system using an impulse, we are in fact inputting many simultaneous frequencies into that system. Consequently its output, its impulse response, are those many frequencies either being increased, reduced, delayed or left intact by the system. In order for this method to work correctly the bandwidth of the input should be an order of magnitude greater than the bandwidth of the SUI. Question 15 Is the bandwidth of the proposed input for this exercise adequate for this application ? 40. Patch up the experiment in figure 11 . The RC NETWORK is to be implemented as the System under Investigation (SUI). The clock signal at DAC-1 is 3.3kHz. Figure 11: PRBS noise S.U.I , followed by correlator 6-18 © 2011 Emona Instruments Experiment 6- Integration, convolution, correlation V1.2 Figure 12: Patching diagram for S.U.I investigation 41. Select the radio button “SG-PRBS”. Once again to run the correlation you will need to shift the reference SG-PRBS over its entire range of the delay positions, and plot the output of the correlator (the INTEGRATE AND HOLD output value) versus the delay index value. 42. Plot this waveform on the graph below with the RC NETWORK implemented as the System under Investigation. Do a quick run through to determine the range of values to expect. This will help for plotting. Then quickly plot every point. Experiment 6- Integration, convolution, correlation © 2011 Emona Instruments 6-19 Graph 3: in/out correlation plots Question 16 Describe the output waveform from the correlator for the RC NETWORK SUI ? Resembles the impulse response of an RC NETWORK. Figure 13 : in/out waveforms for both SUI; RC NETWORK & TLPF 6-20 © 2011 Emona Instruments Experiment 6- Integration, convolution, correlation V1.2 43. Vary the SUI from the RC NETWORK block to the TUNEABLE LPF. Set the FREQUENCY control knob to the 9 o'clock position. Sweep the correlator from 0 to 30 while viewing the correlator output and set the GAIN level of the TUNEABLE LPF to avoid the correlator output voltage being greater than 10V. (This is to avoid saturation of a signal). 44. Plot the output of the correlator (the INTEGRATE AND HOLD output value) versus the delay index value. Plot this waveform on the graph above. Question 17 Describe the output waveform from the correlator for the TUNEABLE LPF ? Even though the PRBS used as the noise source has only a short length this simple exercise has been adequate to confirm in principle that correlation of input and output noise waveforms from a system can be used to determine the impulse response of the system. Part 5: Matched filtering using “integrate and dump” circuitry The majority of transmitted data signals are in the form of square pulses. The optimum filter at the receiver for maximising the signal to noise ratio for square pulses would have a square impulse response. Since square pulses are symmetrical the time-reversal is not relevant. By now you know that the output signal of such a filter is the convolution of the input signal and the filter impulse response, which is the integration of the product of these two signals over the bit period (for finite length signals). The product of two DC values (ie: square pulse & square response) is a DC value. At the end of the bit period whatever the result of the integration of this DC value is the filter output value for that bit alone. Hence the combination of the multiply function and an “integrate and dump” function will implement an optimum matched filter for square pulse data signals. This is the same correlator structure we’ve been using throughout this experiment. In this case we can skip the MULTIPLIER as the signals are both DC and it would only add a scaling factor. 45. Patch together the experiment setup below in figure 15 . Experiment 6- Integration, convolution, correlation © 2011 Emona Instruments 6-21 Figure 14: block diagram for integrate & dump filtering Figure 15: patching diagram for integrate & dump filtering 46. Set the PULSE GENERATOR Frequency = 500 Hz, DUTY CYCLE = 0.5 (50%). Select the radio button “ noise”, for an output of uniform white noise at DAC-1. 47. At the SFP, setup the signal gain = 1.0 and the noise gain = 1.0. View the various signals: noise free original data, data signal with noise, “integrate and dump” signal, and “integrate and hold” signal. Notice the “filtering action” of the I & D on the wideband noise. In communications jargon, the ratio of Signal to added Noise is known as the SIGNAL-NOISE RATIO, SNR, and is usually expressed in decibels (dB), according to the following formula, where V1 is the input signal level and V2 is the output signal level: Gain (or attenuation) in dB = 20 log (V2/V1) 6-22 © 2011 Emona Instruments Experiment 6- Integration, convolution, correlation V1.2 Figure 16 : examples of in/out waveforms for I & D filter Question 18 How many errors do you estimate are occurring in the recovered data signal after the filter ? 48. Reduce the signal gain to = 0.5 and leave the noise gain = 1.0. View the various signals: noise free original data, data signal with noise, “integrate and dump” signal, and “integrate and hold” signal. You are reducing the SNR. 49. Reduce the signal gain and increase the noise gain to 2.0 (maximum) until you determine that some errors may be occurring in the output signal. Figure 17 :noise free data signal and I&D output after addition of noise, with zero errors Question 19 How do you determine when errors are occurring ? At what signal levels did this occur ? Experiment 6- Integration, convolution, correlation © 2011 Emona Instruments 6-23 50. Plot some examples of the input and output signals to the INTEGRATE AND DUMP filter for various levels of SNR. Graph 4: integrate & dump filtering You should be able to see in this exercise that despite the level of noise being very high relative to the signal level integration process is a very powerful noise rejection capability. Put simply, this is because the noise has an average value of zero whereas the signal as a distinctly positive or negative average value. To see this even more clearly for yourself view the output of the integrate and dump block for the signal alone and for the noise alone. It can be shown theoretically that this integrate and dump filter is the optimum matched filter for the square pulse data signals were used in this exercise. Hopefully in this experiment you have been able to see this principle in action for yourself with real electrical signals. 51. Reduce the signal level gain to 0 at the SFP and view the integration of the noise signal alone. Have the noise signal gain set to 1.0 52. Reduce the noise level gain to 0 at the SFP and view the integration of the data signal alone. Have the data signal gain set to 1.0 6-24 © 2011 Emona Instruments Experiment 6- Integration, convolution, correlation V1.2 Tutorial Questions Q1. Determine the CCF between a sine wave and a cosine wave of the same frequency. Q2. (a) In working out the solution of the MF what are assumptions about the noise and the filter? (b) What is the reason why gaussian noise is assumed in the theoretical derivation of the MF? (c) What is a "power-limited system"? Give an example. (d) The use of square pulseforms is not suitable in bandlimited applications. Explain. Q3. (a) What is the Fourier transform of the ACF? (b) What happens to the correlation interval of the ACF when the bandwidth of the signal is decreased (e.g. by means of a lowpass filter)? (c) What is the ACF of white noise? (d) The two-sided power spectrum of a given signal is a gaussian bell. What is the ACF shape? ( (e) What is the ACF of a sinewave? Q4. (a) Describe three methods for measuring the impulse response (b) List disadvantages of using a narrow pulse input (c) List advantages of the CCF method (d) List advantages of the step function method Experiment 6- Integration, convolution, correlation © 2011 Emona Instruments 6-25 References Lynn.P.A, “An introduction to the analysis and processing of signals”; Macmillan Langton.C, ”Linear Time Invariant (LTI) Systems and Matched Filter”, www.complextoreal.com G.R. Cooper and C.D. McGillem (Purdue), "Probabilistic methods of Signal and System Analysis", Holt Rinehart and Winston 2nd Ed 1986 6-26 © 2011 Emona Instruments Experiment 6- Integration, convolution, correlation V1.2 Experiment 8 – Exploring complex numbers and exponentials Achievements in this experiment You will be understand the fundamentals of complex numbers and their usage in signals analysis. You understand the significance of the exponential and the use of the complex exponential ejθ. You understand their relevance in terms of real signals. Preliminary discussion “That this subject [imaginary numbers] has hitherto been surrounded by mysterious obscurity, is to be attributed largely to an ill-adapted notation. If, for instance, +1, -1, √-1 had been called direct, inverse and lateral units, instead of positive, negative and imaginary (or even impossible) then such an obscurity would have been out of the question. -Carl Friedrich Gauss (1777-1855) This quote from Gauss is a good place to start in our exploration of what complex numbers mean and how they are useful to mathematicians, scientists and engineers. From the very earliest use of these concepts, confusion has abounded as to what and imaginary number actually is and how it is useful. By relating as much as possible to real signals and their manipulation, this experiment hopes to clarify and consolidate the understanding for the student about this issue. Figure 1: portrait of Leonhard Euler 1707-1783 Leonhard Euler, one of the great mathematicians, was born in Basel,Switzerland. He achieved his master’s degree at age 16. Private student of Johann Bernoulli, he then went on to author over 900 publications covering many diverse topics in mathematics and science. His memory was legendary and he could recite the entire Aeneid word for word. A famous equation (worth reading about) is Euler’s identity: eiπ + 1 = 0 Although in general mathematics the imaginary part of a complex number is identified by the letter “i”, in electrical engineering in order to avoid confusion with the symbol for current “i”, the symbol for the imaginary part of a complex number uses the letter “j”. As there is much overlap between mathematics and electrical engineering, you will at time find these symbols used interchangeably. 7-2 © 2011 Emona Instruments Experiment 7 – Exploring complex numbers & exponents V1.2 Pre-lab preparation Question 1 Confirm your understanding of the algebra associated with complex number by solving these equations using the binomial method : a) (3 + i2) + (5 – i6) b) (3 + i2) x (5 – i6) c) (3 + i2) - (5 – i6) d) (a + ib) + (c + id) e) (a + ib) x (c + id) f) (a + ib) x (a – ib) Question 2 Confirm your understanding of the algebra associated with complex number by solving these equations using vectors. Sketch your working on the graph below: a) (3 + i2) + (5 – i6) b) (3 + i2) x (5 – i6) c) (3 + i2) - (5 – i6) d) (a + ib) + (c + id) e) (a + ib) x (c + id) f) (a + ib) x (a – ib) Graph 1: Vector arithmetic Experiment 7 – Exploring complex numbers & exponents © 2011 Emona Instruments 7-3 Equipment PC with LabVIEW Runtime Engine software appropriate for the version being used. NI ELVIS 2 or 2+ and USB cable to suit EMONA SIGEx Signal & Systems add-on board Assorted patch leads Two BNC – 2mm leads Procedure Part A – Setting up the NI ELVIS/SIGEx bundle 1. Turn off the NI ELVIS unit and its Prototyping Board switch. 2. Plug the SIGEx board into the NI ELVIS unit. Note: This may already have been done for you. 3. Connect the NI ELVIS to the PC using the USB cable. 4. Turn on the PC (if not on already) and wait for it to fully boot up (so that it’s ready to connect to external USB devices). 5. Turn on the NI ELVIS unit but not the Prototyping Board switch yet. You should observe the USB light turn on (top right corner of ELVIS unit).The PC may make a sound to indicate that the ELVIS unit has been detected if the speakers are activated. 6. Turn on the NI ELVIS Prototyping Board switch to power the SIGEx board. Check that all three power LEDs are on. If not call the instructor for assistance. 7. Launch the SIGEx Main VI. 8. When you’re asked to select a device number, enter the number that corresponds with the NI ELVIS that you’re using. 9. You’re now ready to work with the NI ELVIS/SIGEx bundle. 10. Select the Lab 7 tab on the SIGEx SFP. Note: To stop the SIGEx VI when you’ve finished the experiment, it’s preferable to use the STOP button on the SIGEx SFP itself rather than the LabVIEW window STOP button at the top of the window. This will allow the program to conduct an orderly shutdown and close the various DAQmx channels it has opened. Ask the instructor to check your work before continuing. 7-4 © 2011 Emona Instruments Experiment 7 – Exploring complex numbers & exponents V1.2 Experiment Complex numbers In the pre-lab preparation work you refreshed your understanding of the arithmetic to do with complex numbers. Each complex number can be represented as a point at two-dimensional plane and when joined to the origin of the plane with a line they are known as vectors. They can be expressed in either rectangular or polar coordinates depending on convenience for the task at hand. Figure 2: diagram of complex number The relationship between the Cartesian and polar coordinates systems is as follows: x = cos (θ); y = sin(θ); also it is convenient to express the number using Eulers formula: eiθ = cos(θ) + isin(θ) The use of i for the vertical component denotes that it is the component in the vertical or imaginary axis. The use of θ is fairly obvious as the angle the number makes with the horizontal or real axis. However the introduction of ‘e’ is somewhat more perplexing, so we will briefly mention it here. Overview of the derivation of eix using series Knowing the following series: ex = 1 + x + x2/2! + x3/3! + x4/4! + … sin x = x – x3/3! + x5/5! - … cos x = 1 – x2/2! + x4/4! - … Where n! is factorial n Now, substituting ix for x, we get eix = 1 + ix + (ix)2/2! + (ix)3/3! + (ix)4/4! + … And knowing that i2 = -1; i3 = -i; i4 =5 1; i = i and substituting in eix = 1 + ix - x2/2! - ix3/3! + x4/4! + ix5/5! - … If we separate the I terms, it gives eix = (1 – x2/2! + x4/4! - …) + i(x –x3/3! + x5/5! - …) From above we note that these terms are sin x and cos x, so eix = cos x + i.sin x Experiment 7 – Exploring complex numbers & exponents © 2011 Emona Instruments 7-5 Complex functions If the angle θ is replaced with a varying angle, varying in time, such as wt, then we have: ejwt = cos(wt) + jsin(wt) As the angle θ is now a function of time, then the vector is also moving in relation to time, and is in fact rotating at the rate w, which corresponds to w/2π revolutions per second. We can call this vector a “phasor”. Let us take a look at what this means with real signals. In this TAB, the SCOPE and XY GRAPH will BOTH display the actual signal is as connected to by the scope leads. The phasor plot will display signals derived from the amplitude and phase settings on the tab itself and output to the ANALOG OUT terminal , DAC-1 & DAC-0. These will be the same signals if you make connections as outlined in experimental procedure. Figure 3: patching for DAC1 to CH1, DAC0 to CH0, and both to ADDER 11. Patch up a SIGEx model of the system in Figure. Connect CH1 scope lead to DAC-1 output and CH0 lead to DAC-0 output. Settings are as follows: SCOPE: Timebase = 40ms, Trigger on CH1, Trigger level =0V DAC1: Reference amplitude = 1; Phase = 0 degrees DAC0: Reference amplitude = 1; Phase = -90 degrees Question 3 Write the equation for signals at DAC-1 and DAC-0 as a function of time in the form: A.cos(wt + θ). Think of the centre of the scope timeline as the instant t=0. 12. Observe phasor plot and XY graph and confirm they are as expected. Question 4 Explain why the XY graph displays a circle ? 7-6 © 2011 Emona Instruments Experiment 7 – Exploring complex numbers & exponents V1.2 13. Vary the phase settings for DAC-1 and DAC-0 and observe the phasor plot and XY graph. Confirm your understanding of what they display. 14. Disconnect the scope lead from DAC-0. The graphs will now only display signal from DAC-1. Pay attention to the XY graph. 15. Reconnect DAC-0, and disconnect the scope lead from DAC-1. The graphs will now only display signal from DAC-0. Again pay attention to the XY graph. Question 5 Explain the signal as viewed on the XY graph ? 16. Vary the settings as follows : Ref amplitude DAC1 = 1; Phase = -15 degrees Ref amplitude DAC0 = 1.2; Phase = 75 degrees Question 6 Write the equation for signals at DAC-1 and DAC-0 as a function of time in the form: A.cos(wt + θ). 17. Vary the settings back as follows : Ref amplitude DAC1 = 1; Phase = 0 degrees Ref amplitude DAC0 = 1; Phase = 90 degrees 18. Leave the CH1 scope lead connected to DAC1 output and move the CH0 scope lead to the output of the adder “f+g”. You are now viewing the sum of the two sinusoids. Question 7 Measure and document the equation for the sum of the two sinusoids. Compare this with the expected resultant using the phasor method. 19. Leave the CH1 scope lead connected to DAC1 output and leave the CH0 scope lead to the output of the adder “f+g”. You are still viewing the sum of the two sinusoids. Set up phases to be 0 and 180 degrees. Try also 0 and -180 degrees. Question 8 What is the output sum signal for these settings ? Is this expected ? Explain. Experiment 7 – Exploring complex numbers & exponents © 2011 Emona Instruments 7-7 Figure 4: SIGEx TAB 7 SFP detail displaying real signals via scope On the phasor plot can be seen two phasors representing the outputs from DAC-1 and DAC-0, both sinusoidal signals. The phasor plot shows the relative phase difference an amplitude of each signal but not the rotation. Since are both rotating at the same frequency we do not need to display that rotation. Consequently let us explore the addition of real signals and compare the results with those expected from vector addition. From above we have stated that ejwt = coswt + j.sinwt hence v(t) = Acos(wt + θ) = Re { Aej(wt+θ) } = Re { Ae(jθ).ej(wt) } Ae(jθ) sets up the initial conditions at t=0, ie amplitude & angle As well, it can be shown that v(t) = Acos(wt + θ) = A/2.ejθ.ejwt + A/2.e-jθ.e-jwt Each term is a rotating phasor, with A/2. ejθ.ejwt rotating in a positive direction (counter clockwise) and A/2e-jθ.e-jwt rotating in the negative direction. Negative direction meaning negative frequency, which can be thought of in the same way as a motor spinning in the reverse direction. 7-8 © 2011 Emona Instruments Experiment 7 – Exploring complex numbers & exponents V1.2 These two terms show that sinusoid is the sum of two complex exponentials, which are the conjugate of each other. Let us display these conjugate signals with the SIGEx board. 20. Settings as follows : Ref amplitude DAC1 = 1; Phase = 20 degrees Ref amplitude DAC0 = 1; Set “Phase follow DAC-1” mode switch to ON Setting “Phase follow” mode ON will automatically set the relative phase of the DAC-0 signal to be the negative of the phase for the DAC-1 signal. That is, it will become the “conjugate” signal. Both phasors will be symmetrical about the real axis. 21. Vary the DAC-1 phase setting and observe the phasor plot showing the phasors moving relative to each other. Bear in mind that the sum of these two vectors will fall on the real axis and inscribe a real signal. Next you will measure and plot the resultant real signal amplitude. 22. Connect the scope lead CH-1 to DAC-1 and CH-0 to the adder output “f+g”. 23. Vary the DAC-1 phase from 0-360 degrees in 15 degree steps and note these values in the Table below. Take the peak amplitude value reading, not the peak to peak value. Watch the phasor plot and document the amplitude as negative when the resultant signal is in the negative half-plane. Experiment 7 – Exploring complex numbers & exponents © 2011 Emona Instruments 7-9 Phase (degrees) Resultant amplitude (Vpk) Phase (degrees) Resultant amplitude (Vpk) 0 2 210 -1.75 30 1.75 240 -1 60 1 270 0 90 0 300 1 120 -1 330 1.75 150 -1.75 360 2 180 -2 Table 1: resultant amplitude readings 24. Plot these measured values on the graph below. Graph 2:plot of resultant from measurements 7-10 © 2011 Emona Instruments Experiment 7 – Exploring complex numbers & exponents V1.2 Question 9 What is the equation for this resultant signal ? Exponential functions When a quantity increases or decreases at a rate which is proportional to its value at that instant then that process is known as an exponential process. Expressed as an equation, exponential decay is: dN/dt =-kN where k is the decay constant Solving this equation for N gives us: N(t) = N0e-kt; where N0 is the initial value at t=0. However, the general form for this equation is N(t) = N0.b-kt ; where 0 < 1/b < 1 For every time period where t = 1/k, then N(t) will reduce by the factor of 1/b. In a case where b=2, the function will halve every time constant. In the case where b=e, then the function will reduce by a factor of 1/e (0.36) every time constant. In this section we will use a simple loop to cause a pulse of known amplitude to decay at a variable rate. We can control the rate of decay by adjusting the gain controls of the feedback path. 25. Patch together the experiment as shown in figure . Figure 5 : block diagram for exponentially decaying pulse generation Experiment 7 – Exploring complex numbers & exponents © 2011 Emona Instruments 7-11 Figure 6: patching diagram for decaying pulse generator Settings are as follows: ADDER gains: a0 = 1; a1 = 0.8; b=1; b1=0.36 SEQUENCE GENERATOR: DIPS: UP:UP SCOPE: Timebase: 40ms; Trigger on CH0; Trig level = 1.0V PULSE GENERATOR: Frequency = 1000Hz, Duty cycle=0.5 (50%) 26. Confirm that the gain settings are as indicated and view the output of both loops simultaneously with both scope leads. 27. Confirm for yourself that the signal decaying rapidly is decaying at the rate 1/e = 0.36. You would expect this as each sample out of the loop will be approximately 0.36 times less than the previous input. Once the initial pulse is input to the loop, the input settles to zero and only feedback signals remain in the loop. 28. Try varying the gain a1 to various values between zero and one. In particular, set gain a1 to 0.5 and view this signal. Question 10 What is the equation for this resultant signal for a1=0.5 ? Question 11 What is another term for the time constant when a1=0.5 ? What is most interesting of all these exponential waveforms is that when the decay rate equals ‘e’, then the rate of change equals the value of the function itself at that instant. This only occurs when the decay rate equals e. This form is known as natural decay, and occurs in many natural processes, and is the basis for natural logarithms. Whilst it is outside the scope of this lab manual, it is very interesting to read about the number e, epsilon, and is well covered in one of the references. 7-12 © 2011 Emona Instruments Experiment 7 – Exploring complex numbers & exponents V1.2 Experiment 8 – A Fourier Series analyser Achievements in this experiment Compose arbitrary periodic signals from a series of sine and cosine waves. Confirm the Fourier Series equation. Compute fourier coefficients of a waveform. Build and use a Fourier Series analyser. Demonstrate that periodic waveforms can be decomposed as sums of sinusoids. Introduce complex notation. Preliminary discussion In Lab 3 we discovered that sinewaves are special in the context of linear systems (time invariance assumed). Unlike other waveforms, a sinewave input emerges at the output as a sinewave. We saw in Lab 4 that this makes it possible to completely characterize the behaviour of a system in this class by simply measuring the output/input amplitude ratio and the phase shift of the sinewave as a function of frequency. Now, this is fine if we only need to process sinewaves -- is it feasible to make use of this when dealing with other kinds of inputs ? For example, when the input is a waveform like the sequence of digital symbols we investigated in Lab 4. One possibility is to see whether a non-sinusoidal waveform could be expressed as a sum of sinewaves, over a suitable frequency range, either exactly, or even approximately. If this could be done, the system output can then be obtained by exploiting the additivity property of linear systems, i.e., first obtain the output corresponding to each sinusoidal component of the input signal, then take the sum of the outputs. This was covered in Lab 4. In this Lab we explore this idea by means of an ancient technique based on the generation of beat frequencies -- somewhat like when a musician uses a tuning fork. We will begin by adding together many beat frequencies and view the resulting waveform. From there we will look at the equations and use what we know from trigonometry to decompose waveforms into their constituent components. Pre-requisites: Familiarization with the SIGEx conventions and general module usage. A brief review of the trigonometry required will be covered as needed. 8-2 © 2011 Emona Instruments Experiment 8 – A Fourier Series analyser V1.2 Equipment PC with LabVIEW Runtime Engine software appropriate for the version being used. NI ELVIS 2 or 2+ and USB cable to suit EMONA SIGEx Signal & Systems add-on board Assorted patch leads Two BNC – 2mm leads Procedure Part A – Setting up the NI ELVIS/SIGEx bundle 1. Turn off the NI ELVIS unit and its Prototyping Board switch. 2. Plug the SIGEx board into the NI ELVIS unit. Note: This may already have been done for you. 3. Connect the NI ELVIS to the PC using the USB cable. 4. Turn on the PC (if not on already) and wait for it to fully boot up (so that it’s ready to connect to external USB devices). 5. Turn on the NI ELVIS unit but not the Prototyping Board switch yet. You should observe the USB light turn on (top right corner of ELVIS unit).The PC may make a sound to indicate that the ELVIS unit has been detected if the speakers are activated. 6. Turn on the NI ELVIS Prototyping Board switch to power the SIGEx board. Check that all three power LEDs are on. If not call the instructor for assistance. 7. Launch the SIGEx Main VI. 8. When you’re asked to select a device number, enter the number that corresponds with the NI ELVIS that you’re using. 9. You’re now ready to work with the NI ELVIS/SIGEx bundle. 10. Select the Lab 8 tab on the SIGEx SFP. Note: To stop the SIGEx VI when you’ve finished the experiment, it’s preferable to use the STOP button on the SIGEx SFP itself rather than the LabVIEW window STOP button at the top of the window. This will allow the program to conduct an orderly shutdown and close the various DAQmx channels it has opened. Experiment 8 – A Fourier Series analyser © 2011 Emona Instruments 8-3 The experiment Part 1 – Constructing waveforms from sine & cosines A simple sinusoid with zero phase can be represented by the equation (Eqn 1) And a cosinewave with a frequency of n times can be simply represented by the equation (Eqn 2) Any wave which is an integer multiple of another frequency is known as a harmonic of the frequency. So equation 2 represents the harmonics of the signal in equation for n >1. We can use the “harmonic summer” simulation in Experiment TAB 8 to view and sum multiple signals which are harmonics of the fundamental signal ie: the signal for n=1. Harmonics for which n is even are known as even harmonics, and when N is odd are called odd harmonics. This simulation allows us to view and sum any sinusoid for which 1 <= n <= 10, that is, the fundamental and nine harmonics. The numeric entry boxes allow you to enter the amplitude of each sinusoid. 11. Experiment a little by entering various amplitudes into the numeric entry boxes for the cosine row. Confirm for yourself visually that what is displayed is as you would expect. 12. Set all amplitudes to zero, except for the “1st” component, the fundamental, which you can set to 1. Moving from the second to the ninth sequentially, set each amplitude to the equal to 1. As you do this notice how the combined signal is changing. Do this for the cosine row ONLY at this point. Question 1 How would you expect the summation of to look if you could add up many more harmonics ? Question 2 What is its peak amplitude and is this as expected ? Question 3 Is the fundamental an odd or even function ? Is the summation odd or even ? 8-4 © 2011 Emona Instruments Experiment 8 – A Fourier Series analyser V1.2 Question 4 Write the equation for the summation of the 10 signals ? Is it symmetrical about the X axis? Question 5 Vary the amplitudes and notice how the signal changes . You may set the amplitude of certain components to 0 as you see fit. Can you create a wave form which starts at a zero value ? Write the equation for your new varied amplitude signal ? Does it start at a zero value ? 13. Sketch your arbitrary wave form, for which you have just written the equation, below. Graph 1: sine wave summation Experiment 8 – A Fourier Series analyser © 2011 Emona Instruments 8-5 The general form of the equation for the summation of cosine harmonics is as follows: where are the amplitude values of each cosine wave. 14. Set all cosinewave amplitudes equal to 0 and now set the sine waveform amplitudes equal to 1, starting from the first harmonic and moving sequentially until the 10th harmonic. Notice how the summation changes as you add harmonics. Question 6 How would you expect the sine summation of to look if you could add up many more harmonics ? Question 7 What is its peak amplitude and is this as expected ? Is this an odd or even function ? Question 8 Vary the amplitudes and notice how the signal changes . You may set the amplitude of certain components to 0 as you see fit. Can you create a wave form which starts at a non-zero value ? Write the equation for your new varied-amplitude signal ? Does it start at a non-zero value ? Is it symmetrical about X axis.? The general form of the equation for the summation of sine wave harmonics is as follows: where are the amplitude values of each sine wave. The general form for the summation of both sine and cosine harmonics is: 8-6 © 2011 Emona Instruments Experiment 8 – A Fourier Series analyser V1.2 Even functions are symmetrical about the Y axis. Odd functions are not symmetrical about the Y axis, but appear to be inverted about the X axis on the negative side of the Y axis. Sine and cosine waves, as well as their sums of sine and cosines, are always symmetrical about the X axis. Being symmetrical means that they cannot represent a DC offset. In order to have a DC offset we must add a constant to the equation. 15. Add a DC component to the signal by inputting the value into the DC numeric entry box ? Let us add a value a0 to represent that constant and the general equation for our arbitrary wave form becomes where N is max number of harmonics present. In our experiment above, N=10. This equation describes any arbitrary wave form with the proviso that it is periodic. Any periodic waveform, no matter how complicated, can be represented by the summation of many simple sine and cosine waveforms. This equation is known as the Fourier series equation, naturally enough named after Jean Baptiste Joseph, Baron de Fourier, 1768 – 1830. Figure 1: Portrait of Joseph Fourier Let us have a further look at this important equation. When N equals one, this frequency known as the fundamental frequency, is also called the resolution frequency. Being the smallest frequency in this series it defines the minimum separation between components in a particular waveform. In the Fourier series equation above we have grouped waves in terms of whether they are sine or cosine waveforms. Let us now modify this equation and group individual components by their harmonic number. This is easy enough and is as follows Experiment 8 – A Fourier Series analyser © 2011 Emona Instruments 8-7 Grouping in this way allows us to think of each frequency as having both a sine and cosine component. Let us have a quick revision of what adding a sine and a cosine of the same frequency together may result in. 16. Using the “harmonics summer” simulation in the Experiment 8 TAB of the SIGEx SFP, set all amplitudes including that of the DC equal to 0. Set the amplitude of the sine and cosine first harmonic equal to 1. View the resulting summation. Question 9 Write the equation for the summation of these 2 waves ? Write the equation for the summation in terms of the sine wave with a non zero phase shift. 17. Vary the amplitudes from 0 to 1 and notice how the signal changes . Question 10 Describe how the summation changes as you vary the respective amplitudes? Question 11 For a particular pair of amplitudes you have set, write the equation for the summation in terms of sine and cosine as well as its equivalent polar representation ? 8-8 © 2011 Emona Instruments Experiment 8 – A Fourier Series analyser V1.2 18. Sketch a vector or for phasor representation of these two signals and their resulting summation, known as the resultant. Graph 2: components & resultant For each harmonic, nwt, a signal may have a sine and cosine component, implemented by their own respective amplitude, an and bn. It is helpful to think about these component pairs as a single entity at a particular frequency. The only difference between them being their respective amplitude and the respective orientation or phasing. We know that a sine wave is 90° out of phase with a cosine wave, a quality which makes those two components orthogonal to each other. By orthogonal we mean that they operate independently of each other. And so we need a notation and document these two-dimensional pair of components and this notation is provided to us by Euler with his famous equation: Where j the notes the component at 90° out of phase with the other component, hence the sine and cosine pair. Experiment 8 – A Fourier Series analyser © 2011 Emona Instruments 8-9 Hence we can replace all sine/cosine pairs at a particular harmonic n with the complex exponential function ejnwt, and in this way the Fourier series can be rewritten as where Cn represents the resultant from the pair of respective amplitudes for the sine and cosine components. ie: Cn2 = bn2 + an2, and is known as the “complex fourier series”. Euler's formula allows us to process the sine/cosine component pair , simultaneously, rather than individually. It is a form of two-dimensional notation where the sine and cosine components for a frequency are instead treated together as a resultant with particular phase ie polar notation. This notation is known as “complex” notation and was introduced in the previous experiment, Experiment 7. Remember that the practical part of this experiment just completed above shows us how a resultant waveform is represented by two orthogonal components. Part 2 – Computing Fourier coefficients In the previous part of this experiment we discovered that we can construct any arbitrary periodic waveform by the summation of a number of sine and cosine harmonics. This knowledge is the basis of signal synthesis and in this part of the experiment we will do the reverse process, that is, the analysis of an arbitrary wave form to discover the presence and amplitude of its constituent harmonics. We call these amplitudes the Fourier coefficients of the waveform as they are the coefficients within the Fourier series equation we have just derived. Armed with only some basic trigonometry we will now explore some more qualities of sinusoids. Before we create our arbitrary wave form to be analysed let us determine some rules with which we can build our analyser. We know that the area under a sine wave or a cosine wave over a timeframe of one period will always be equal to 0. Consequently we know that the area under a sine wave or cosine wave for a timeframe of any number of periods will also be equal to 0. To determine the area mathematically we would integrate over the timeframe of interest. This process would give us the average value of the signal during that time. This average value is the DC component of the signal. Figure 2: model for integrating one period of a sinusoid 8-10 © 2011 Emona Instruments Experiment 8 – A Fourier Series analyser V1.2 The INTEGRATE & DUMP module can be used to integrate over a single period as denoted by the input clock. This is well suited to integrating periodic waveforms such as sinusoids and products thereof. In this next exercise we will integrate a sinusoid over a single period to prove the assertion that the area under a sine wave or a cosine wave over a timeframe of one period will always be equal to 0. 19. Connect the model as per Figure 2 above. The clock connection is necessary for this module, unlike for the continuous time INTEGRATORS on the SIGEx board. Settings are as follow: SCOPE: Timebase: 4ms; Trigger on Ch0; Connect Ch0 to CLK input; Level=1V FUNCTION GENERATOR: Select SINE output, AMPLITUDE = 4vpp, FREQUENCY=1kHz Refer to the SIGEx User Manual for instructions on how the I&D and I&H functions work if this is not obvious. NOTE: The I & D period is from positive clock edge to positive clock edge. Question 12 What is the output value at the end of the integration period ? HINT: the I&H function will hold the final value. 20. While viewing the I&D output, to broaden your understanding of the integration process, change the incoming signal from sine to triangle to bipolar squarewave at the FUNCTION GENERATOR VI and confirm that the integrated output is as you would expect over one period. You should be able to confirm that integration is the accumulation of the total signal charge, with positive signals adding to the total, and negative signals subtracting from the total. DC extraction using LPF Another way of extracting the DC component of a signal is by using a filter which is tuned to a sufficiently low-frequency to exclude all harmonics except for the DC component. The integration process you have just explored is also a form of filtering, (as discussed in Experiment 6 on matched filtering.) We will use the filtering method next. Note that in this next part of the experiment the signals we are using are generated from data arrays in LabVIEW and output in a synchronized manner from the ANALOG OUT terminals DAC-0 and DAC-1.These signals are thus synchronized to each other, just as they appear on screen and in the textbook. 21. Using the left hand side of Experiment 8 TAB of the SIGEx SFP, select a sine wave , 1st harmonic. Connect DAC-1 to the input of the TUNEABLE LPF and view both input and output with the scope. Settings are as follow: SCOPE: Timebase 4ms; Rising edge trigger on CH0; Trigger level=0V TUNEABLE LPF: GAIN=mid position Experiment 8 – A Fourier Series analyser © 2011 Emona Instruments 8-11 Adjust the frequency control, fc, of the TLPF from fully clockwise moving counterclockwise until the output signal is a DC value of approximately 0 V. Try this test for several harmonics. Change the “sine harmonic” value to 2,3 or 5 etc to try this. INSIGHT 1: average value of an integral number of periods of sine or cosine waves equals zero. Note that as far as the filter is concerned a single cosine wave is the same as a sine wave, so Insight 1 holds true for both. You can vary the phase of the sinewave out of DAC-1 using the “sine phase” control. The signal out of DAC-0 remains constant as a cosine wave. 22. Set the “sine harmonic “ value back to 1. Set “sine phase” to 0. View DAC-1 with CH1 and DAC-0 with CH0. Settings as follows: SCOPE: Timebase 4ms; Rising edge trigger on CH0; Trigger level=0V DAC-1 will be a sine wave and DAC-0 a cosine wave, relative to each other. Connect as shown in the figure below. View the output of the MULTIPLIER as well as the output of the TUNEABLE LOW PASS FILTER. Figure 3: comparing sinusoids You will now multiply a sine wave by a cosine wave and determine its average value. Repeat this with the second and third harmonic of the sinusoid. Question 13 What is the average value of these three products ? INSIGHT 2: average value of an integral number of products of any sine or cosine harmonics equals zero. 8-12 © 2011 Emona Instruments Experiment 8 – A Fourier Series analyser V1.2 23. Set the “sine harmonic “ value back to 1. Set “sine phase” to 90. View DAC-1 with CH1 and DAC-0 with CH0. Settings as follows: SCOPE: Timebase 20ms; Rising edge trigger on CH0; Trigger level=1V DAC-1 will now be a cosine wave and so will be DAC-0. NB: This is relative to the start of the signal data array. See the ANALOG OUT VIEWER window for confirmation. Connect as shown in the figure above. View the output of the MULTIPLIER as well as the output of the TUNEABLE LOW PASS FILTER with the scope. You will now multiply a cosine wave by itself and determine its average value. Question 14 What is the average value of the product of a cosine by itself ? INSIGHT 3: average value of an integral number of products of any sine by its harmonic equals zero. INSIGHT 4: average value of an integral number of products of any sine by itself equals a non zero value.The same holds for cosine. Question 15 Write the complete formula for the product of a cosine, Acoswt, by itself? What do the terms represent? At this point we can see that the only product to yield a non-zero average value is that of a sine wave by the same sine wave. The same is true for cosine. So if we multiply an arbitrary waveform by a particular “probing” sine or cosine harmonic and extract the average value of this product there will only be non-zero when that arbitrary wave form contains that particular “probing” harmonic as one of its constituent components. This is a very powerful insight and allows us to have a simple tool with which to analyse arbitrary wave forms. Let us now give this a try. 24. Construct the following arbitrary wave form using the HARMONIC SUMMER on the right hand side of the SIGEx SFP, Experiment 8 TAB. Settings are as follows : Cosine amplitudes: 1, 0, 0.5,0,0,1,0,0,0,0 Sine amplitudes: 0,0.3,1,0,0,0,2,0,0,0 DC level: 0.5 Experiment 8 – A Fourier Series analyser © 2011 Emona Instruments 8-13 Switch “to DAC-0” ON: This will output the summation to DAC-0. See the ANALOG VIEWER window. Set “sine harmonic” =1; Set “sine phase = 0. This signal is output to DAC-1. SCOPE: Timebase 4ms; Rising edge trigger on CH0; Trigger level=0V Figure 4: comparing sinusoids 25. You will need to now ensure that the overall gain of the MULTIPLIER and TLPF is unity. We know from the User Manual specifications that the MULTIPLIER gain is approximately unity, whereas the TLPF GAIN is variable. Connect both MULTIPLIER inputs to the same 1st harmonic sinewave and view the output. While viewing the TLPF output, turn the fc control clockwise to pass the entire signal. Adjust the TLPF gain precisely for a 4Vpp output, so as to have unity gain throughout the “analyser” path. 26. Return to your previous setup but do not touch the TLPF GAIN setting for the rest of the experiment. At this point we are multiplying the arbitrary wave form which investigated by a first harmonic sine wave. Figure 5: example of SIGEx SFP Tab “Lab 8” including harmonic generator bottom left, and summer on the right 8-14 © 2011 Emona Instruments Experiment 8 – A Fourier Series analyser V1.2 27. View the product at the output of the multiplier on CH0 and the TLPF output. Adjust the TLPF frequency control to isolate the DC component. Note the value of the DC level as the amplitude of the first harmonic sinusoid in the table below. Increase harmonics one by one, adjust theTLPF frequency setting if necessary and note the amplitude for the remaining 10 sine harmonics in table. Now to analyze for the cosine components. 28. Set “sine harmonic” back to 1. Change “sine phase” to 90. This will convert the sine wave into a cosine wave , as sin(wt + 90) = cos(wt). Repeat the above steps to all 10 cosines and enter your measurements of the TLPF DC output level into the table . Harmonic number sine (V) cosine (V) 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th DC (V) = Table of measured coefficients 29. Connect the input of the TLPF directly to the arbitrary wave form at DAC-0 to measure the DC value of that waveform alone, and enter into the table at “DC (V) = “. Question 16 How do your readings compare with expectations ? . Explain any discrepancies . Experiment 8 – A Fourier Series analyser © 2011 Emona Instruments 8-15 30. While you have the experiment setup, vary the harmonic summer settings and see the resulting output from the TLPF. Experiment a little with values while you have the system setup and ready. 8-16 © 2011 Emona Instruments Experiment 8 – A Fourier Series analyser V1.2 Part 3 – Build a manually swept spectrum analyzer In the previous part of this experiment we use synchronised signals which were generated in LabVIEW and output via the DACs of the ANALOG OUT module. In this part of the experiment we will analyse the constructed arbitrary signal using an independent sinusoid generator, that is, the FUNCTION GENERATOR. Figure 6:building a “wave analyzer” 31. Once again construct the following arbitrary waveform using the HARMONIC SUMMER of the SFP, Experiment 8 TAB. Launch the FUNCTION GENERATOR as well. Settings are same as above, and are as follows : Cosine amplitudes: 1, 0, 0.5,0,0,1,0,0,0,0 Sine amplitudes: 0,0.3,1,0,0,0,2,0,0,0 DC level: 0.5 Switch “to DAC-0” ON SCOPE: Timebase 20ms; Rising edge trigger on CH0; Trigger level=0V FUNCTION GENERATOR: Frequency=1000Hz, Amplitude=4Vpp, Sine wave selected 32. Move the input to the multiplier which was connected to DAC-1 to the FUNC OUT terminal of the FUNCTION GENERATOR . This signal will be a 4Vpp sine wave at 1000 Hz. View both inputs to the multiplier on the scope. One is the arbitrary waveform, the other is the 1000 Hz sine wave. Question 17 What do you notice about their phase relationship ? Is this to be expected ? Explain. If the inputs are drifting relative to each other then you would expect the product of the inputs to also be slowly varying. 33. View the sinusoid and the product, output of the multiplier, at the same time and confirm that it is slowly varying. Trigger the SCOPE on the sinusoid to get a more stable display. As it varies it will pass through the point of interest, the interface point that we wish to measure. This point occurs twice per cycle lasts creating both are maxima and minima. If we detect either the maximum of the minima the absolute value of these will give us the average DC value which we require. Experiment 8 – A Fourier Series analyser © 2011 Emona Instruments 8-17 You may wish to review your understanding of why these maximas and minimas occur when signals drift relative to each other. You can use both trigonometry and/or the DAC outputs and the MULTIPLIER module to revisit this topic. 34. Now view both the output from the FUNCTION GENERATOR and the output of the TLPF. Adjust the frequency of the TLPF to isolate only the DC component and confirm that it has a maxima and a minima. HINT: if the DC value is varying too slowly, or you are impatient, or just inquisitive (…a good thing), increase the frequency at the function generator by 1 Hz. This will make your DC value vary at a rate of approximately 1 Hz (…much easier to view). Trigger on the sinewave from the FUNCTION GENERATOR for a stable display. HINT: use Y-AUTOSCALE ON/OFF to center the display 35. Vary the frequency of the function generator in steps of 1000 Hz starting from 1000 Hz up to 7000 Hz. Note the maximum value of the DC output in the table below. It will be more accurate to measure peak to peak and then halve it.These will be the measured amplitudes of the constituent harmonics making out the arbitrary wave form. How do they compare with the actual amplitude value entered into the SFP itself.? HINT: to vary the FUNCTION GENERATOR Frequency, place the cursor alongside the digit to be varied and then use the UP and DOWN keyboard arrows to vary the digit value. Input frequency (Hz) TLPF output pp swing (V) Half of pp (V) Entered values Calculated resultant (V) 1000 2000 3000 4000 5000 6000 7000 DC (V) = Table of measured coefficients 8-18 © 2011 Emona Instruments Experiment 8 – A Fourier Series analyser V1.2 Question 18 Can you explain if your readings differ in some places from the actual value ? HINT: you have one value per harmonic instead of two. Consider the previous discussion above about resultants in your answer. And allow for MULTIPLIER and TLPF gains (although you should have set the overall gain to unity in an earlier part of the experiment). Whilst the theoretical modeling with the synchronized sine and cosine waves from the previous part is able to yield the constituent sine and cosine components, a real world signal without the benefit of synchronization can only measure the resultant amplitude. This is shown in the exercise just completed. 36. This section of the experiment was about building a manually swept spectrum analyser. The function generator instrument has the ability to be automatically swept. As an exercise in automation enter an appropriate start, stop frequency, say 1001 & 10001 Hz, as well as step size of 1000 Hz and a step interval of 2 seconds and allow the function generator itself to sweep the analysing frequency while you view the amplitude of the DC value from the analyser which corresponds to the amplitude of each harmonic present. Display the FUNCTION GENERATOR sinewave also, and trigger the scope on it for a stable display of 4Vpp. Set the AUTOSCALE to OFF. Congratulations, you have just constructed a swept spectrum analyzer using basic mathematical blocks. Experiment 8 – A Fourier Series analyser © 2011 Emona Instruments 8-19 Part 4 – analyzing a square wave We will now use our manually swept spectrum analyser to investigate which harmonics at present in a square wave. The experiment set up is as for the previous section except that now the input is taken from the PULSE GENERATOR module output. Figure 7: working with a square wave 37. Vary the patching as shown in figure 7 above . Settings are as follows: FUNCTION GENERATOR: Frequency=1000Hz, Amplitude=2Vpp, Sine wave selected PULSE GENERATOR: FREQUENCY=1000Hz, DUTY CYCLE=0.5 (50%) SCOPE: Timebase 4ms; Rising edge trigger on CH1; Trigger level=0V 38. Vary the frequency of the function generator in steps of 1000 Hz starting from 1000 Hz up to 7000 Hz. (Remember, you can vary the input frequency by 1 or 2 Hz to speed up the resultant DC oscillation display).Note also the maximum value of the DC output in the table below. These will be the amplitudes of the constituent harmonics making up the squarewave. You may know from theory that a square wave of 50% duty cycle contains only odd harmonics. This can help you focus your investigation around the appropriate frequencies. 8-20 © 2011 Emona Instruments Experiment 8 – A Fourier Series analyser V1.2 Input frequency (Hz) TLPF output amplitude (V) Scaled measured values (V) Calculated resultant (V) 1000 2000 3000 4000 5000 6000 7000 DC (V) = Table of measured coefficients for squarewave Question 19 Why are some of the harmonics hard to detect ? Varying the duty cycle of the PULSE GENERATOR from the SFP control “DUTY CYCLE”, for example to 0.2 (20%) will introduce even harmonics. Question 20 Can you now detect even harmonics in the squarewave of 20% duty cycle ? View the output from the MULTIPLIER to see what signal you are measuring and extracting the DC value from. Experiment 8 – A Fourier Series analyser © 2011 Emona Instruments 8-21 Comparing measured Fourier series coefficients to theory From the theory the relative value of the Fourier series coefficients for a 50:50 square wave is a series like so: 1, 1/3, 1/5, 1/7….1/n where n is the odd harmonic present in the squarewave. Question 21 Compare your measured coefficients for the first 4 odd harmonics as ratios to that expected by theory ? Remember to normalize the measurements for the comparison. References Langton.C.,”Fourier analysis made easy ”, www.complextoreal.com 8-22 © 2011 Emona Instruments Experiment 8 – A Fourier Series analyser V1.2 Experiment 9 – Spectrum analysis of various signal types Achievements in this experiment You will use a spectrum analyser to observe real signals in the frequency domain. You will discover important relationships between time and frequency domain characteristics of various classes of signals. Preliminary discussion We are well familiar with the virtues of the scope as our eyes for observing signals and waveforms in the time domain. In this Lab we discover the reality of the frequency domain through the eyes of the spectrum analyser. Various experiments introduced in earlier labs are extended through the use of the spectrum analyser. An important theme is the observation of special properties, such as those relating to periodic waveforms, and to discrete-time signals. By understanding the frequency domain characteristics of various signal types, we can further develop our ability to think in both the time AND frequency domain when considering signals. The two go hand in hand and it is essential for the engineer to be well versed in both. Having hands-on experience with signals and their spectrums will consolidate the theory, particularly of broad spectrum signals, in a way that supports the learning of telecommunications principles in other coursework. Signals and their spectrum are the foundation for several other fields of study. 9-2 © 2011 Emona Instruments Experiment 9 – Spectrum analysis V1.2 Pre-requisite work Question 1 What is the conversion equation for a linear voltage scale to a logarithmic scale ? Question 2 What linear ratio does a -6dB gain equal ? Question 3 List some of the more important characteristics of PN sequences: Question 4 Multiply a sinewave with a squarewave so as to create a halfwave rectified sinewave and calculate its spectrum: Experiment 9 – Spectrum analysis © 2011 Emona Instruments 9-3 Equipment PC with LabVIEW Runtime Engine software appropriate for the version being used. NI ELVIS 2 or 2+ and USB cable to suit EMONA SIGEx Signal & Systems add-on board Assorted patch leads Two BNC – 2mm leads Procedure Part A – Setting up the NI ELVIS/SIGEx bundle 1. Turn off the NI ELVIS unit and its Prototyping Board switch. 2. Plug the SIGEx board into the NI ELVIS unit. Note: This may already have been done for you. 3. Connect the NI ELVIS to the PC using the USB cable. 4. Turn on the PC (if not on already) and wait for it to fully boot up (so that it’s ready to connect to external USB devices). 5. Turn on the NI ELVIS unit but not the Prototyping Board switch yet. You should observe the USB light turn on (top right corner of ELVIS unit).The PC may make a sound to indicate that the ELVIS unit has been detected if the speakers are activated. 6. Turn on the NI ELVIS Prototyping Board switch to power the SIGEx board. Check that all three power LEDs are on. If not call the instructor for assistance. 7. Launch the SIGEx Main VI. 8. When you’re asked to select a device number, enter the number that corresponds with the NI ELVIS that you’re using. 9. You’re now ready to work with the NI ELVIS/SIGEx bundle. 10. Select the Lab 9 tab on the SIGEx SFP. Note: To stop the SIGEx VI when you’ve finished the experiment, it’s preferable to use the STOP button on the SIGEx SFP itself rather than the LabVIEW window STOP button at the top of the window. This will allow the program to conduct an orderly shutdown and close the various DAQmx channels it has opened. Ask the instructor to check your work before continuing. 9-4 © 2011 Emona Instruments Experiment 9 – Spectrum analysis V1.2 Experiment Spectrum of the impulse train We will generate a train of impulse responses, and pass these through a BASEBAND LPF channel and display the spectrum both before and after filtering. Figure 1: pulse source to S.U.I. 11. Patch together the experiment as shown in Figure above. Settings are as follows: PULSE/CLK GENERATOR: 500 Hz; DUTY CYCLE=0.1 (10%) SCOPE: Timebase 40 ms; Rising edge trigger on CH1; Trigger level=1V Connect CH1 to input, CH0 to output of BASEBAND LPF. Ensure FFT: Y-scale set to Linear mapping. 12. Observe the pulse train on the scope. Measure the width and repetition interval, and confirm that these are as you would expect for the settings on the PULSE GENERATOR you have selected. NB: Its always a good idea to measure and confirm that signals set up on equipment are as expected, to avoid errors and wasted time. 13. Observe the spectrum of this pulse train. The spectrum analyser should be set for a linear frequency axis and linear scale for the vertical axis. Vary the timebase, which in return varies the frequency scale, to provide a convenient balance between range and resolution in the frequency display. You can also switch between this experiment’s tab and the ZOOM FFT TAB for more control over the FFT display if you prefer without disrupting any settings. 14. Note that the spectrum consists of discrete components. Confirm that the interval between components is determined by the pulse frequency. Experiment 9 – Spectrum analysis © 2011 Emona Instruments 9-5 Figure 2 (a): Spectrum of single width impulse with linear scaling (b) Spectrum of double width impulse with linear scaling Question 5 At what frequencies do the nulls occur at ? 15. Increase the width of the pulse, to double, but not the frequency, by varying the duty cycle of the pulse train. Set the PULSE GENERATOR DUTY CYCLE to 0.2 (20%) 16. Confirm that the frequency interval between nulls is determined by the pulse width. Question 6 What is the mathematical relationship between null spacing and the pulse width ? 17. Confirm that the spacing of the individual components of the spectrum, ie: its harmonics, have not changed with the double width pulse. 18. Make suitable measurements of the spectrum amplitude to show that the shape of the envelope is of the form sin(x)/x for both impulse widths. Confirming the ratio of envelope peaks would be one important characteristic to check. 19. Verify that the general form of the spectrum is not affected by the clock frequency ie: that it still maintains the sin(x)/x shape. Question 7 What are the characteristics of the sin(x)/x form that you are looking for ? 9-6 © 2011 Emona Instruments Experiment 9 – Spectrum analysis V1.2 20. Now, reduce the width of the pulse, but not the frequency, by again varying the duty cycle of the pulse train. Set the PULSE GENERATOR DUTY CYCLE to 0.02 (2%) 21. Confirm that the frequency interval between nulls is determined by the pulse width ? You may need to vary the scope timebase to alter the FFT frequency display range. 22. Try a final reading with a duty cycle of 1 %. Set the PULSE GENERATOR DUTY CYCLE to 0.01 (1%) Question 8 What is the general trend that you are observing as the duty cycle tends towards 0 ? Question 9 Using the various findings so far, what shape you expect the spectrum of a single pulse, that is, a pulse train with very large separation between pulses, to have ? Spectrum of the filtered impulse train 23. Return to the original single width pulse settings. Settings are as follows: PULSE/CLK GENERATOR: 500 Hz; DUTY CYCLE=0.1 (10%) SCOPE: Timebase 40 ms; Rising edge trigger on CH1; Trigger level=1V Connect CH1 to input, CH0 to output 24. Observe the scope display of the pulse response at the BASEBAND LPF channel output. Figure 3(a) impulse after filtering (b)post–filter spectrum 25. Ensure that the pulse width is narrow enough such that the filtered pulse output is the impulse response of the channel. Experiment 9 – Spectrum analysis © 2011 Emona Instruments 9-7 26. Observe the frequency response of this output and compare with the response of the unfiltered input train. This is most easily done by viewing input and output simultaneously on both channels of the scope. Sketch these responses below: Graph 1: impulse train responses 27. Determine and plot the response characteristic of the BASEBAND LPF. This will be the ratio of the output to the input. If you have viewed the frequency responses using a log/dB scale on the vertical axis, then this process is a straightforward subtraction of input from the output. Modify the FFT display Y scale Mapping settings to be set to Logarithmic for these measurements. Duty cycle and sampling In the section above you have determined the frequency response of a periodic pulse train with variable duty cycle. This is the typical signal used as a sampling pulse train. Sampling will be covered in a later experiment (X12 – Sampling) in this manual. It suffices at this point to emphasize that the spectrum of the sampling signal will be interacting with the message to be sampled, hence it is imperative to be familiar with it and its characteristics. Start with a square wave from the PULSE GENERATOR, frequency = 500Hz, set to duty cycle = 50%. Slowly reduce the duty cycle from 50, to 40, then 30 and finally 20%, and observe the 9-8 © 2011 Emona Instruments Experiment 9 – Spectrum analysis V1.2 occurrence of even harmonics. You should realise that at 20% you have the same spectrum studied above and you should have an insight into the origin of the harmonics present. “Sinc pulse” trains In previous experiments we have encountered spectrums of rectangular pulse trains which are shaped by the sin(x)/x form. This sin(x)/x characteristic is known as the “sinc function”. A rectangular shaped signal in the time domain results in “sinc function” shaped frequency response spectrum. In this part of the experiment we investigate the spectrum of pulse with sin(x)/x shaping in the time domain ie a sinc function in time. For convenience we will use a repetitive train of sinc pulses. 28. A sinc pulse train is available at the ANALOG OUT : DAC-1 module. View this signal with a SCOPE channel in both the time and frequency domain. Settings are as follows: SCOPE: Timebase = 10ms, Trig level = 0.5V With this signal we have a unique situation where the spectrum is finite. In order for this to occur this sinc pulse must itself be infinite in the time domain, and in fact a true single sinc pulse is only asymptotically limited in time. That is, it tends to zero in both positive and negative time directions. In this experiment we have made a approximation by repeating the pulse in a train and terminating the oscillations after about 20 cycles. Figure 4: sinc pulse and its bandlimited spectrum; exponential pulse for comparison Question 10 At what time instants does the sync pulse have a zero crossings ? 29. Sketch both the sinc pulse and its spectrum in a graph below, and annotate the diagrams of all the relevant measurements. Experiment 9 – Spectrum analysis © 2011 Emona Instruments 9-9 Graph 2: sync pulse train time and frequency responses 30. As per the steps taken above in the impulse section, apply this sinc pulse train to the BASEBAND LPF module and observe its input and output in both the time and frequency domain. Plot the output frequency response on the graph above. Figure 5: TUNEABLE LPF time & frequency response to the sinc pulse train 31. It is also interesting to see the difference in response between the BASEBAND LPF and the TUNEABLE LPF. Pass the sync pulse train through the TUNEABLE LPF and slowly reduce the -3dB cutoff frequency to the same as that of the BASEBAND LPF as found above. Notice the difference in the roll off rate. 9-10 © 2011 Emona Instruments Experiment 9 – Spectrum analysis V1.2 Applying an impulse train and sync pulse to a system is equivalent to applying many simultaneous sinusoids. Spectrum of pseudorandom sequence In this set of exercises we examine and compare the spectra of various forms of pseudorandom sequences. Usually known as PRBS (Pseudo random bit sequences).We will begin with short clocked Maximal Length sequences, i.e. the kind of sequence available at the SEQUENCE GENERATOR module. Next we will examine longer length clocked Maximal Length sequences. Finally we will look at a non-Maximal length sequence. It is interesting to consider how pseudorandom sequences are generated. Firstly, it has to be said that they are named “pseudo” random as they are not truely random sequences. They are actually periodic and completely deterministic. However they have numerous qualities which make them useful as signals. PN sequences are created by structures such as shown in Figure 6. These structures can either be implemented in hardware via shift registers, or in software.They are usually called LFSR (Linear feedback shift registers). . Figure 6: block diagram for the of SIGEx SEQUENCE GENERATOR sequence (DIPS UP:UP) In this example, 5 registers are used, resulting in a sequence of period 25 – 1. There is one less than the maximum number possible as state [00000] is considered illegal. Question 11 Why do you suppose state [00000] is illegal ? 32. Patch together the experiment in Figure 7 and view both the output X as well as the SYNC output from the SEQUENCE GENERATOR. Experiment 9 – Spectrum analysis © 2011 Emona Instruments 9-11 Figure 7: patching diagram for PN sequence from SEQUENCE GENERATOR Settings are as follows: PULSE GENERATOR: Frequency = 2000 Hz, Duty cycle = 0.5 (50%) SEQUENCE GENERATOR: DIPS set to UP:UP SCOPE: Timebase = 100ms, TRIG set to CH1, connected to SG SYNC; level = 1V CH0 connected to LINE CODE output, CH1 connected to SYNC The LINE CODE output from the SEQUENCE GENERATOR is a zero DC version of the X output, and is more convenient for viewing due to no DC component. 33. View the spectrum of this signal. Can you see where the nulls occur. Vary the scope timebase so that you can see the separation between the individual harmonics of the PN sequence. Notice the sin(x)/x form of the spectrum. Use the ZOOM FFT TAB for more resolution. Question 12 Where do the nulls occur ? What is the separation between harmonics ? What do these values relate to ? to be approx 66Hz.Theory states 2000/31 = 64.5 Hz 34. Switch to a 6-bit generated sequence with length of 26 – 1 = 63 bits. This is with SEQUENCE GENERATOR DIPs set to UP:DOWN. Set the SCOPE timebase to 100 ms. 35. Confirm that the nulls and harmonic separation are in accordance with the relationships we uncovered in the previous part of the experiment. When considering a PN sequence such as this example, it is easy to see the repetition of such short sequences, and hence to understand that it is not truely random. You can even count the one and zeros, and runs of ones and zeros and prove to yourself some of the characteristics of these maximal length sequences. Try this for yourself. You can also see that if such a sequence is correlated against itself,ie: autocorrelated, then it will only have one position in which there is strong correlation. Hence these sequences are useful for coding in spread spectrum type systems. But what about a non-maximal length sequence. It follows by considering the description, that a non-maximal length sequence repeats in less than the maximum possible periods. 9-12 © 2011 Emona Instruments Experiment 9 – Spectrum analysis V1.2 36. Switch to another 6-bit generated sequence. This is with SEQUENCE GENERATOR DIPs set to DOWN:UP. This sequence however is non-maximal length, and you can see that it repeats 3 times within the period time of the previous sequence. As well, its spectrum is quite different than for a maximal length sequence. It has an irregular form. Vary the timebase and look at the separation between harmonics. Figure 8: Non-maximal length sequence spectrum, clocked at 2kHz. 37. Finally, switch to the longest sequence on the SIGEx board, a 14-bit generated maximal length sequence, with length of 214 – 1 = 16k bits. This is with SEQUENCE GENERATOR DIPs set to DOWN:DOWN. You may need to vary the clock rate and scope timebase to effectively measure this sequence. Question 13 Where do the nulls occur ? What is the separation between harmonics ? What do these values relate to ? Analog noise generation (AWGN) As we have just seen with the PN sequences, the spectrum of composed of many evenly spaced harmonics with a rolloff to repetitive nulls. If we wish to create a signal composed of many evenly spaced harmonics of equal amplitude, we can isolate a small region of the PN sequence spectrum and use that as our signal. Using a low pass filter we can attenuate all harmonics above say 10% PN CLOCK frequency and then we are left with a signal with White Gaussian Noise characteristics which is useful in various experiments as a noise source. AWGN stands for “additive white Gaussian noise” meaning the type of noise which is imposed on a signal travelling through a particular noisy channel. Experiment 9 – Spectrum analysis © 2011 Emona Instruments 9-13 38. Patch together Figure 9 and view the output of the TUNEABLE LPF. Set the TUNEABLE LPF control both to fully clockwise at this stage. View the input and output signals to the filter in the time domain and the frequency domain. Figure 9: block diagram for PRBS generated analog noise Figure 10: patching diagram for PRBS analog noise Settings are as follows: PULSE /CLK GENERATOR: Frequency= 2000, Duty cycle = 0.5 (50%) SEQUENCE GENERATOR: DIPS set to UP:UP (short sequence) SCOPE: Timebase = 100ms. 39. With the cutoff frequency of the TUNEABLE LPF above 12kHz, you can view the unfiltered PN sequence as a bipolar sequence. We are using the bipolar output from the SEQUENCE GENERATOR as we want a bipolar analog output with no DC component. 40. Slowly reduce the cutoff frequency until you have reached approximately 200-300 Hz. You can see this from the spectrum display. Consider the output of the filter in the time domain. Is it a satisfactory noise signal ? Question 14 How many harmonics are visible in the filter output ? 41. Switch the SEQUENCE GENERATOR DIPS to DOWN:DOWN. This will select the longest sequence. Now take a look at the output from the filter. Would you describe this as a satisfactory noise signal ? It certainly looks like “noise” with no visible repetition. 9-14 © 2011 Emona Instruments Experiment 9 – Spectrum analysis V1.2 Question 15 How many harmonics are visible in the filter output ? Calculate this. Question 16 Is this analog noise signal periodic ? What is its period ? Calculate this When analysing the frequency response of systems, rather than sweeping a single frequency across the band, it is convenient to input a multi-frequency signal such as this PN noise, and then view the system response spectrum all in one display. This approach is used is several later experiments in this SIGEx Lab Manual and is particularly useful when used with an averaging display. Non-linear processes: clipping, rectification and harmonic multiplication Clipping or amplitude limiting a sinusoid can often occur in a system due to overload conditions. It may even be done on purpose in cases where the amplitude does not carry any information and class C amplifiers are to be used. Class C amplifiers are not linear and the maintenance of amplitude of the signal is not critical. These are typically used with FM signals, which are signals which do not carry any information in their amplitude but depend solely on the frequency and phase of the signal. Although slight clipping of a sinusoid does not appear to be drastic when viewed in the time domain it will be interesting to see what effect it has on the frequency domain. 42. Patch together Figure 11 and view the output of the LIMITER block. View the input and output signals to the LIMITER in the time domain and the frequency domain. Figure 11: clipping a sinusoid signal Experiment 9 – Spectrum analysis © 2011 Emona Instruments 9-15 Settings are as follows: FUNCTION GENERATOR: Select SINE output, frequency = 1k, amplitude= 4Vpp. LIMITER DIPS set to UP:UP SCOPE: Timebase = 10 ms. 43. Patch together the figure above and view both the input and output of the LIMITER block. Vary the LIMITER DIP switch settings to all for possible positions and sketch observations on a graph below. Graph 3: clipped signals and spectra You can see that different levels of clipping are applied to the input sinusoid depending on the position of the DIP switch. Label your sketch with these levels, you may wish to use terms such as low, medium, high. Question 17 What effect does a higher level of clipping have on the spectrum of the clipped signal ? 9-16 © 2011 Emona Instruments Experiment 9 – Spectrum analysis V1.2 44. Vary the frequency of the input sinusoid and observe the change in the harmonics of the clipped output. Question 18 What is the relationship between the input frequency and the output harmonic frequencies ? 45. Switch from the LIMITER block to the RECTIFIER block, and observe the spectrum of the rectified sine wave. Plot the responses on the previous graph. Question 19 What can you say about the spectrum of the rectified sine wave ? Is this what you would have expected ? Refer back to your pre-lab preparation questions. Question 20 Is the clipping process a linear or non-linear process ? Explain. Experiment 9 – Spectrum analysis © 2011 Emona Instruments 9-17 Tutorial questions Q1 What are some of the characterictics of non-linear processes ? 9-18 © 2011 Emona Instruments Experiment 9 – Spectrum analysis V1.2 Experiment 10 – Time domain analysis of an RC circuit Achievements in this experiment You will analyse a simple network using tools such as steps, impulses, exponential pulses and sinusoids to compare theory and practical results. You will then synthesize and test an equivalent network using a 1st order feedback structure. Preliminary discussion The RC circuit is a simple form of network which involves electrical charge storage elements. It is these “storage elements” such as capacitors and inductances which create the delays in signals often referred to as “leads” and “lags” in signal phases relative to each other. Figure 1: RC network; circuit and block diagram From the experiment on Exponentials, remember that RC is the time taken to for an unit exponential to decay to e-1 = 1/e = 0.37 of its initial value 10-2 © 2011 Emona Instruments Experiment 10 – Time domain analysis of an RC circuit V1.2 Pre-requisite work Question 1: the step response This question follows the integration method in Section 4 of S.K.Tewksbury's notes http://stewks.ece.stevens-tech.edu/E245L-F07/coursenotes.dir/firstorder/cap-difeq.pdf (a) Apply elementary circuit theory to show that the voltage equation for the RC circuit in Figxxx is V_in (t) = i (t). R + V_cap (t) = i (t). R + Q(t)/C Eq prep1.1 Where Q(t) is the charge in capacitor C. (b) Show that this can be expressed as (d/dt)(V_in) = R.di/dt + i/C Consider the case where V_in(t) is a step function of amplitude V_o and the capacitor charge Q(t) = 0 at t = 0. Show that for t > 0 (d/dt)(V_in) = 0 and the DE reduces to di/dt = - a. i [a = (1/RC)] Use (d/dt)log_e(i) = 1/i to show that the solution of the DE is i(t) = i_o exp( - a.t) (t > 0) [i_o = V_o/R] (c) Use Eq 1.1 to show that V_out(t) = V_cap(t) = V_in(t) - R.i_o exp( - a.t) Hence the step response V_out/V_in = (1 - exp(- a.t)) (d) Plot the result in (c) for a = 1000 (e) What is the asymptotic value of the step response as t increases indefinitely? Show that the step response rises to (1 -1/e) of its final value at t = 1/a. Question 2: the impulse response (a) Describe the main properties of the theoretical impulse function. Show that differentiation of the unit step function wrt t produces a unit impulse at t = 0. Apply this to the step response result in Question P1(c) to show that the impulse response h(t) of the RC circuit is a. exp(- a.t) Experiment 10 – Time domain analysis of an RC circuit © 2011 Emona Instruments 10-3 (b) Explain why the impulse function can only be approximated in practice. Sketch an impulse approximation realized as a finite width pulse. Explain why an excessively narrow pulse is undesirable in practical applications. Estimate a pulse width that would be suitable for use with the case in Question P1. Indicate your reasoning. (c) Using the property in (a) we could generate the impulse response by first recording the step response, then differentiating. Compare this alternative with the use of a finite width pulse input. Include discussion of signal peak limitations and output amplitude considerations. (d) Show that the impulse response falls to 1/e of its initial value at t = 1/a Question 3: convolution and response to an exponential input This question introduces convolution and its application in the analysis of systems like the RC circuit in Q. P1. (a) The convolution of the time functions x_1 and x_2 can be expressed as [for t > 0] x_1 * x_2 = Note that the convolution is a function of t and that tau is a dummy variable that has no further role after integration. Show that changing the order (x_2 * x_1) does not change the result. Show that if x_1 is a unit impulse the convolution x_1 * x_2 = x_2(t). Suppose we approximate a continuous time signal x_1(t) as a sum of very narrow contiguous pulses, each of which can be thought of as representing an impulse function (each with its individual amplitude). Suppose next that this pulse train representation of x_1(t) is then applied as input to the system introduced in Q. P1. Each of the pulses in the train will produce an individual output that will be a close (weighted) approximation to the system's impulse response. The overall output will be the sum of these (overlapping) weighted impulse response approximations. Demonstrate that this sum is effectively the convolution of x_1 and the system's impulse response h(t). (Invoke the usual limit methods to morph the discrete sum into a continuous time integral.) (b) Show that for t > 0, the convolution for the case x_1(t) = exp(- a1.t) and x_2(t) = exp(- a2.t) [a1 N.E. a2] is (1/(a2 - a1)) . (exp(- a1.t) - exp(- a2.t) (c) Sketch the graph of the result in (b) versus t over the range t > 0. Show that for positive values of a1 and a2 the function is positive for t > 0, and that it is zero at t = 0 and t-> infinity. Find the peak and the corresponding value of t for a1 = 0.5 and a2 = 1.1 . (d) Use the results in (a) and (b) and in Q. P2(a) to obtain the response of the RC circuit in Q.P1 when the input is 10-4 © 2011 Emona Instruments Experiment 10 – Time domain analysis of an RC circuit V1.2 x_1(t) = exp(- a1.t) (e) Repeat the tasks in (b) and (c) for the case a1 = a2 = a. NB: a useful reference for this question is Schuam Laplace Transforms (1965); p45 (convolution of two exponentials) Question 4: response to a sinusoidal input In Q. P1 we sought the output of the RC circuit in Fig xxx for the case in which the input is a step function. This result was extended in Q. P2 and P3 for an impulse function input and for an exponential input. Now we examine the solution when the input is sinusoidal. This case is of special importance in this work as it opens the way to powerful tools for the solution of systems of much greater complexity than the introductory example under investigation here. (a) Use the result in Q.P1(a) to show that V_in (t) = RC.(dV_out/dt) + V_out (t) Eqn. P4.1 To simplify the analysis we will use the complex exponential A_in.exp(jwt) to represent the input sinusoid [recall that exp(jwt) = cos(wt) + j.sin(wt)]. In Q. P1(b) we obtained a solution of the DE by direct integration. However, sometimes it turns out that invoking a "feeling lucky" approach can provide the desired result: a solution of the form V_out = A_out . exp(j.phi_out) . exp(jw.t) is substituted into the RHS in the above DE. Show that this is a solution for a suitable value of A_out . exp(phi_out). (The suitable value is the one that makes the RHS = LHS). With A_in = 1, show that the sought value is A_out . exp(phi_out) = 1/(1 + jwRC) Hence show that V_out = V_in . 1/(1 + jwRC) = V_in . (1/RC)/ (jw + (1/RC)) Note that this result has a very interesting feature: the output has the same form as the input. [To discover the importance of this property it is worthwhile to think about the use of other waveforms to express the output in terms of the input. For example, a squarewave, a periodic ramp, a sawtooth (an optional lab exercise). ] (b) Use the result in (a) to obtain a formula for the ratio of output amplitude to input amplitude as a function of w for 1/RC = 1000 (rad/sec). Sketch the result, and find the value of w for which the ratio is 3dB. Question 5: solution using the Laplace Transform (a) Look up the definition Y(s) of the Laplace transform of the Experiment 10 – Time domain analysis of an RC circuit © 2011 Emona Instruments 10-5 function y(t). Show that the Laplace transform of (d/dt)y(t) is sY(s). Solve Eqn P4.1 as a function of s by applying the Laplace transform to both sides (note that no restriction is imposed on the form of the input) . Compare this result with the solution obtained with input V_in (t) = A_in.exp(jwt) Comment on similarities and differences. (b) The transfer function is defined as V_out(s)/V_in(s). Use the result in (a) to write down the transfer function of the RC circuit. (c) Find the Laplace transform of y(t) = exp( - a.t). Compare this with the transfer function in (b). (d) What is the relationship between the transfer function and the impulse response that is apparent from (c)? (e) On the basis of (d), what is the operation in the s domain that corresponds to convolution in the time domain? Confirm your answer by looking up the convolution theorem. Question 6: synthesized model of RC circuit (a) Consider Eqn P4.1 in the Laplace domain, i.e., s.V_out = a . V_in + (- a) . V_out Use the block diagram in Task 25 as a guide to model this equation using an integrator (1/s). Note that s.V_out(s) appears at the integrator input. (b) In practical applications the use of a scaled integrator (k/s) may be necessary. Adjust the system equation so that the LHS is (s/k).V_out, and modify the model accordingly. (c) Suppose k = 200 and a = 1000. Determine the corresponding value of a1 in the block diagram in Task 25. 10-6 © 2011 Emona Instruments Experiment 10 – Time domain analysis of an RC circuit V1.2 Equipment PC with LabVIEW Runtime Engine software appropriate for the version being used. NI ELVIS 2 or 2+ and USB cable to suit EMONA SIGEx Signal & Systems add-on board Assorted patch leads Two BNC – 2mm leads Procedure Part A – Setting up the NI ELVIS/SIGEx bundle 1. Turn off the NI ELVIS unit and its Prototyping Board switch. 2. Plug the SIGEx board into the NI ELVIS unit. Note: This may already have been done for you. 3. Connect the NI ELVIS to the PC using the USB cable. 4. Turn on the PC (if not on already) and wait for it to fully boot up (so that it’s ready to connect to external USB devices). 5. Turn on the NI ELVIS unit but not the Prototyping Board switch yet. You should observe the USB light turn on (top right corner of ELVIS unit).The PC may make a sound to indicate that the ELVIS unit has been detected if the speakers are activated. 6. Turn on the NI ELVIS Prototyping Board switch to power the SIGEx board. Check that all three power LEDs are on. If not call the instructor for assistance. 7. Launch the SIGEx Main VI. 8. When you’re asked to select a device number, enter the number that corresponds with the NI ELVIS that you’re using. 9. You’re now ready to work with the NI ELVIS/SIGEx bundle. 10. Select the Lab 10 tab on the SIGEx SFP. Note: To stop the SIGEx VI when you’ve finished the experiment, it’s preferable to use the STOP button on the SIGEx SFP itself rather than the LabVIEW window STOP button at the top of the window. This will allow the program to conduct an orderly shutdown and close the various DAQmx channels it has opened. Ask the instructor to check your work before continuing. Experiment 10 – Time domain analysis of an RC circuit © 2011 Emona Instruments 10-7 Experiment Part 1: Step response of the RC network In previous experiments you have been introduced to the step response as a useful signal with which to investigate a system. In this part of the experiment we will measure the step response of an RC network and compare it to our theoretical expectations. Figure 2: block diagram of RC network; wiring diagram of experiment 11. Wire together the RC NETWORK block with the PULSE GENERATOR block as the source of input signal. Settings are as follows: PULSE/CLK GENERATOR: 50 Hz; DUTY CYCLE=0.5 (50%) SCOPE: Timebase 20ms; Rising edge trigger on CH1; Trigger level=1V Connect CH1 to input, CH0 to output From the preliminary discussion at the beginning of this lab, the unit step response of an RC network is: h(t) = [1 - e-t/RC].u(t) 12. Drawing upon your pre-lab preparation work , use the actual values of the SIGEx RC network to calculate the expected step response signal. Use the values: R = 10,000 ohm, C = 100nF (100 x 10-9 F); hence RC = 1 x 10-3, and 1/RC = 103 = 1000. The time constant for this circuit is 1 ms. Measure the input step size in volts. Question 7 How long will it take this RC NETWORK to rise to a level 37% below its final level ? 10-8 © 2011 Emona Instruments Experiment 10 – Time domain analysis of an RC circuit V1.2 Question 8 Calculate the expected real circuit step response of the RC NETWORK using the real circuit values and real circuit input values. These values are available in the User Manual. For your convenience they are R=10kohm, and C=100nF 13. Confirm that the measured step response corresponds with your theoretical expectations. Characteristics of the exponential waveform were discussed in Experiment 7 on exponentials. Figure 3: exponential waveform Ae(-t).u(t); where u(t) is Heaviside function Experiment 10 – Time domain analysis of an RC circuit © 2011 Emona Instruments 10-9 14. Sketch the step response on the graph below. Show all relevant time constants and voltage levels. Graph 1: step and impulse responses Impulse response of the RC network In earlier experiments where we introduced the impulse function, it was noted that a true impulse, with infinitesimally small width, and infinite amplitude, cannot be actually physically generated. It can however be approximated, by a pulse of finite height and nonzero duration. Our criteria for whether the approximation is adequate is that the impulse is sufficiently brief that there is no discernible change in the “system under investigation’s” output shape as the pulse width is reduced. This is the criteria we will apply here in creating an impulse. 15. Maintain the same wiring for this next step. You now need to input an impulse signal to the RC network under investigation. This is easily achieved by varying the duty cycle of the PULSE GENERATOR block as follows. Leave the FREQUENCY = 50 Hz, and set DUTY CYCLE to 0.05 (5%). 16. Notice how the output amplitude is diminished, and the rise time is still finite and easily visible. The input pulse is not a close enough approximation to a true impulse for our measurements. What is the pulse width currently ? 10-10 © 2011 Emona Instruments Experiment 10 – Time domain analysis of an RC circuit V1.2 17. Further reduce the DUTY CYCLE to 0.01 (1%) and increase the FREQUENCY to 100 Hz for viewing convenience, and to narrow the pulse further. Question 9 What is the width if the impulse. What is its maximum amplitude ? 18. Remove the scope lead to the input signal and view only the output impulse response.Trigger the scope and set the trig level to suit the signal size ie: it is now much less than 1 V. 19. Sketch the impulse response on the graph above. Use a new voltage scale for convenience. From the preliminary discussion at the beginning of this lab, the unit impulse response of an RC network is: h(t) = (1/RC).e-t/RC.u(t) = 1000. e-1000t.u(t) Question 10 What is the equation for the measured impulse response using actual circuit values ? How does this compare with theory ? Question 11 Explain why the impulse response reaches the peak value that it does. HINT: superposition of 2 step responses is involved. Experiment 10 – Time domain analysis of an RC circuit © 2011 Emona Instruments 10-11 Response of the RC network to an exponential pulse In this segment we investigate the response to a more general input. As an example we consider an exponential pulse with a different time constant. This provides an opportunity to revisit convolution as per Prep Question P3. 20. Switch the input signal for this next step to the ANALOG OUTPUT DAC-0. There is present an exponential pulse signal with the equation: x(t) =1.e-500t.u(t) Figure 4: Wiring for RC network with exponential pulse input 21. View both input and output signals. Trigger the scope and set the trig level to suit the signal size ie: it is now much less than 1 V. 22. Notice how the rise time of the output is easily visible with a particular time constant, and well as the decay time having its own time constant. Question 12 What is the equation for the output signal and how does it compare with the theoretical output expected from this network ? Refer to your work in preparation question 3. 10-12 © 2011 Emona Instruments Experiment 10 – Time domain analysis of an RC circuit V1.2 23. Sketch the exponential pulse response, along with input, on the graph below. Graph 2: exponential pulse response Experiment 10 – Time domain analysis of an RC circuit © 2011 Emona Instruments 10-13 Synthesising an RC NETWORK transfer function 24. In the preparation exercises it was shown that the impulse response of this RC NETWORK is given by: h(t) = (1/RC).e-t/RC.u(t) = 1000. e-1000t.u(t) and the corresponding system response in the Laplace domain by H(s) = (1/RC)/(s + (1/RC)) = 1000/(s + 1000) It was also shown that the Laplace domain equation can be modelled with the block diagram below, where k/s represents integration with scaling factor k. Note that the value of k is set by the INTEGRATION RATE DIP switches. Figure 5: block diagram of synthesised “RC network” Question 13 Show that RC = | 1/(k.a1)|; where |k.a1| = 1000 Figure 6: patching diagram of synthesised “RC network” 10-14 © 2011 Emona Instruments Experiment 10 – Time domain analysis of an RC circuit V1.2 25. Patch together this system and investigate its performance using step and impulse responses as per settings below. Sketch the responses below. Settings as as follows for step response: FUNCTION GENERATOR: Select Squarewave output, 1Vpp, 0.5V offset, 100Hz frequency SCOPE: Timebase 10ms ADDER GAINS: a0 = 1.0; a1 = -0.1; a2 = 0 INTEGERATION RATE: DIPS set to UP:UP For impulse response use the PULSE GENERATOR as a source with frequency = 100Hz, Duty cycle = 0.02 (2%) Graph 3: step and impulse response of synthesized system 26. You would expect that a system like this will need a “small” amount of feedback as the change to the original step is not great. However the initial value suggested (-0.1) is not accurate enough. It is a good starting point as the time constant is similar. However the signal amplitude is too large. 27. Change the values of a0 and a1 until you get a perfect match with the actual RC NETWORK. To do this, view both outputs of the RC NETWORK and the synthesised “RC NETWORK” at point Y together and then make adjustments accordingly. Experiment 10 – Time domain analysis of an RC circuit © 2011 Emona Instruments 10-15 HINT: for convenient manual adjustment, you can set the GAIN ADJUST knob on the SIGEx board to vary the a1 gain coefficient, and then hand adjust the level. Figure 7: Step responses: real RC network & synthesised “RC network”. Not fully aligned. Question 14 What values of a0 and a1 have you found give your synthesised system a perfect match to the actual RC NETWORK ? 28. In order to calculate the actual transfer function of this synthesised system you will need to also know the INTEGRATION RATE of the integrator used. In a previous experiment this was measured and you should use the same procedure to remeasure this value. In brief, input a bipolar squarewave to the integrator, with frequency around 300Hz, and amplitude less than 2Vpp from the FUNCTION GENERATOR. The INTEGRATION RATE is equal to ramp voltage spread /ramp time/ input voltage. This value is the k value from Figure 5 above. Question 15 What is the signal at the input to the integrator ? Is this expected ? Explain: Yes, Question 16 Using the measured values above, what is the actual transfer function for your synthesised network which matches the actual RC network ? Show your working. 10-16 © 2011 Emona Instruments Experiment 10 – Time domain analysis of an RC circuit V1.2 Question 17 Explain any discrepancies you find between expected theory and measurements. What sources of error are responsible for these ? 29. Use a varying sinusoid signal to plot the frequency response of the synthesised system and the actual RC network simultaneously. They should track each other. Settings are as follows: FUNCTION GENERATOR: Select SINEWAVE output, 8Vpp, 0V offset, 50Hz frequency SCOPE: Timebase 20ms. Set Y AUTOSCALE to OFF Start from 50 Hz, and take 10 measurements up to 2 kHz. Graph 4: frequency response and bode plot of synthesized system Question 18 Express the 3dB frequency in radians/sec and compare with your answer in Question 11(2) Experiment 10 – Time domain analysis of an RC circuit © 2011 Emona Instruments 10-17 30. Sketch the bode plot for the system on the same graph as the frequency response from the previous step. Show your working. Tutorial questions Q1 (convolution by graphical method) In this exercise we use a graphical method to evaluate the convolution of two exponential functions, i.e., the impulse response of the RC circuit and the input signal in Task 21. The convolution formula is given in prep question P3 (a). Note that you will need to carry out the multiplication of the two functions in the integrand for up to ten values of t. This multiplication and plotting of the result as a function of the integration variable tau could be done with the aid of a computer to save time. It will be evident that the the area under the product will be small when t is large and also when near zero. Compare the outcome with the theoretical result using the method in prep question P3 (a), and with your experimental records. Q2 re convolution theorem (a) Use the results in Q. P5 to obtain the Laplace transforms of the input and the impulse response. (b) Express the product of the transforms in (a) as a partial fraction sum. (c) Obtain the inverse transform of the result in (b) and compare the outcome with the graph of the output response in T24. N.B. There is no need to invoke the inversion formula - each of the two components in the partial fraction sum in (b) is an elementary transform that inverts by inspection). (c) State the convolution theorem and the class of systems for which it applies. Does your result support the convolution theorem? Q3 (re exponential input) This question considers the possibility of using a calibrated exponential input to measure the time constant of the RC circuit. Suppose 1/alfa1 is the unknown time constant of the system under test and 1/alfa2 the time constant of the input exponential. Investigate the behaviour of the output as alfa2 is varied, focussing on the magnitude and position of the peak. 10-18 © 2011 Emona Instruments Experiment 10 – Time domain analysis of an RC circuit V1.2 Experiment 11 – Poles and zeros in the Laplace domain Achievements in this experiment You will discover how poles and zeros can be used to visualize frequency responses graphically at a glance, in a minimal-math zone. You will be able to use this knowledge to intuitively design low order continuous-time responses. You will be ready to extend this concept to higher order systems, and discrete-time applications Preliminary discussion In the early days of linear system design, long before the advent of programmable computing, numerous graphical techniques were invented to get around the arithmetic tedium required to calculate system responses. One of these is the pole-zero technique. A century on, this scheme has remained in the system engineer's tool kit because it provides a medium for the intuitive visualization of system behaviour, especially in regard to stability and sensitivity. And, with some circuit structures, there is a bonus: by observing the movement of the poles and zeros, you can intuitively predict system response variations as components are tuned. Part 1: We examine the behaviour of lowpass and bandpass responses generated with the second order feedback system in Fig. 1 in the context of poles and zeros. Part 2: The findings in Part 1 are extended to create special filters realized with the feedbackfeedforward system in Fig. 2. The pole-zero paradigm is applied to discover intuitive interpretations of the associated equations. Part 3: We discover how maximally flat and critically damped responses are generated. It should take you about 60 minutes to complete this experiment, not including the preparation to be done before the hands-on lab work. 11-2 © 2011 Emona Instruments Experiment 11 – Poles & zeros in the Laplace domain V1.2 Pre-requisite work Preparation will be required in order for the hands-on lab work to make sense. This guided preparation is a revision of theory you will have covered in lectures and is presented below as a number of computation exercises. This work should be completed before attempting the lab. Question 1 For the system in Figure 1, obtain a differential equation relating the output x0(t) and the input u(t). Show by substitution that x0 = ejωt is a solution and determine the corresponding input u(t) that produces this output. If you are uncomfortable with a complex-valued function to represent the behaviour of a system that is supposed to operate with real-valued signals, x0 = cos(ωt) or sin(ωt) could be used. However, you will quickly discover that the exponential function has a very useful property that simplifies the math considerably. Remembering that cos(ωt) is Re{ ejωt}, you can carry out the analysis with ejωt then simply take the real part of the result. Practitioners generally don't bother with the formality of taking the real part. Moreover, complex valued signals are easily realized in digitally implemented systems, and indeed, frequently used, for example in modulators and demodulators of dial-up modems. INPUT x2 x1 x0 u -a1 -a0 Figure 1: schematic of 2nd order integrator feedback structure without feedforward. Question 2 From the above, with x0 = ejωt, obtain an expression for the ratio x0/u as a function of jω (not just "ω"; the reason for this will emerge shortly). Note that this ratio is complex valued. Then, obtain its magnitude and phase shift as functions of ω (not jω). Experiment 11 – Poles & zeros in the Laplace domain © 2011 Emona Instruments 11-3 Question 3 From the results in Question 1 above, plot the magnitude |x0/u| versus ω (radians/sec) for the case a0 = 0.81, a1 = 0.64 . Note that there is a progressive fall off as ω increases. Hence, we can think of this system as realizing a lowpass filter. Graph 1:response plot Question 4 We now consider an alternative way of getting the response. With a little algebra we create a graphical medium that will provide an intuitive environment for visualizing and generating both magnitude and phase responses. First, return to the expression for x0/u obtained in (a) and replace "jω" by the symbol "s". Look upon s merely as a convenient stand in for jω. It is not necessary to ascribe any deeper significance to this substitution for the purposes of this lab. The result is the (complex-valued) rational function x0/u = H(s) = 1/(s2 + a1.s + a0) (Eqn 1). For the case a0 = 0.81, a1 = 0.64 (as in (b), express the denominator quadratic in the factored form (s - p1)(s - p2), where p1 and p2 are the roots. Show that these are given by p1 = 0.9(cos(110.8°) + j.sin(110.8°)) = 0.9expj0.616π p2 = 0.9(cos(110.8°) - j.sin(110.8°)) = 0.9exp-j0.616π 11-4 © 2011 Emona Instruments (Eqn 2). Experiment 11 – Poles & zeros in the Laplace domain V1.2 Question 5 Express the complex points p1 and p2 from equation 2 above as the non-exponential complex form of a + ib, that is, with a real and imaginary part. Question 6 Next, we look at a graphical approach for evaluating the factors (s - p1) and (s - p2). Place crosses ("x") on a complex plane at the locations corresponding to p1 and p2, as obtained in (c) above. Place a dot at the point 1.2 on the j axis, i.e., the complex value jω = j1.2 . Join this point and the crosses at p1 and p2 with straight lines. Satisfy yourself that the lengths of these joining lines are |jω - p1| and |jω - p2|. Noting that 1/|H(jω)| is the product of these two magnitudes, estimate |H(j1.2)|. Graph 2: vector subtraction Experiment 11 – Poles & zeros in the Laplace domain © 2011 Emona Instruments 11-5 Question 7 Use the idea above to obtain estimates of |H| at other frequencies and thus produce a sketch graph of |H| over the range 0 to 5 radian/s. (ie: ω will range from 0 to 5). Notice that the presence of a peak in the response is obvious from the behaviour of the vector from p1 as the dot on the j axis is moved near p1. Note that this vector has much greater influence than the other vector, especially near the peak. Compare this estimate with the computed result you obtained in (b). Plot at least 4 points over this range, choosing your points to reflect the important characteristics of this response. Explain why the vector from p1 has a greater influence on the peak of the response. Graph 3:plot the calculated magnitude response |H(jw)| Question 8 The roots p1 and p2 of the denominator polynomial of H(s), marked as crosses on a plane of the complex variable s are known as poles of H(s). Note that in the example case, p2 is the complex conjugate of p1. Why is this so? 11-6 © 2011 Emona Instruments Experiment 11 – Poles & zeros in the Laplace domain V1.2 Question 9 Derive Eqn1 from the schematic (block) diagram, Figure 1, without using the differential equation step. That is, treat the integrator as a "gain" of value 1/s and process the equations as algebra. Question 10 Next we proceed to the system in Fig 2. Note that this is a simple extension of the feedback only system in Fig. 1. Use Eqn 1 to obtain the output/input equation y/u , y/u = H_y (s) = (b2.s2 + b1.s + b0)/(s2 + a1.s + a0) Eqn3 (i) Consider the case b0 = 2.0, b1 = 0, b2 = 1.0 . Show that the roots of the numerator for these coefficients are z1 = 0 + j1.414, z2 = 0 - j1.414 . Place an "o" on these points on the same s plane diagram you used to mark the poles, Graph 2. The roots of the numerator are known as "zeros". b2 x2 b1 x1 b 2 x0 b0 y u -a1 -a 0 Figure 2: schematic of 2nd order integrator feedback structure with feedforward combiner. Experiment 11 – Poles & zeros in the Laplace domain © 2011 Emona Instruments 11-7 Question 11 Using the zeros with the method from Question 6, carry out the graphical estimation of the numerator of Eqn 3 at s = j1.2. Note that this is a special case, with the zeros located on the j axis (since b1 = 0). Hence, the lines joining the point jw and the zeros will lie on the j axis. Combine the numerator and denominator estimates to obtain |H_y(j2)|. Extend to other values of w, and sketch the magnitude response |H_y(jω)|. Comment on the presence of a null at ω = 1.414. Question 12 (optional) Compute |H_y(jω)| from Eqn 3 and assess the quality of the estimate based on poles and zeros. Question 13 With a0 and a1 as in Question 3, apply the pole-zero method to obtain approximate graphs of the magnitude response for the following cases: b1 = 1, b0 = b2 = 0 b2 = 1, b0 = b1 = 0 b2 = 1, b1 = −a1, b0 = a0 b2 = 1, b1 = 0, b0 = a0 State the name of the response type corresponding to each case (e.g., bandstop, allpass, etc). For the allpass case, plot the phase and/or group delay response (group delay = − d(phase)/d ω). Find out and note here an application for the allpass response. 11-8 © 2011 Emona Instruments Experiment 11 – Poles & zeros in the Laplace domain V1.2 Graph 4: various responses Question 14 The integrators in Figs 1 and 2 were depicted as having unity gain. A practical realization normally has an associated gain constant. The corresponding integrator equations have the form x0 = k . ∫(x1) dt x1 = k . ∫(x2) dt Note that k is not dimensionless. Its unit is sec-1. The SIGEx INTEGRATOR modules provide a choice of four values of k, selectable by means of on-board switches. The switches are labelled “INTEGRATION RATE” and the selection and associated value is displayed on the SIGEx SFP. Suppose k = 12,500 sec-1 is selected. Modify the frequency scale for the response in (b) above to reflect this choice of k. Explain your reasoning here. Experiment 11 – Poles & zeros in the Laplace domain © 2011 Emona Instruments 11-9 Equipment PC with LabVIEW Runtime Engine software appropriate for the version being used. NI ELVIS 2 or 2+ and USB cable to suit EMONA SIGEx Signal & Systems add-on board Assorted patch leads Two BNC – 2mm leads Procedure Part A – Setting up the NI ELVIS/SIGEx bundle 1. Turn off the NI ELVIS unit and its Prototyping Board switch. 2. Plug the SIGEx board into the NI ELVIS unit. Note: This may already have been done for you. 3. Connect the NI ELVIS to the PC using the USB cable. 4. Turn on the PC (if not on already) and wait for it to fully boot up (so that it’s ready to connect to external USB devices). 5. Turn on the NI ELVIS unit but not the Prototyping Board switch yet. You should observe the USB light turn on (top right corner of ELVIS unit).The PC may make a sound to indicate that the ELVIS unit has been detected if the speakers are activated. 6. Turn on the NI ELVIS Prototyping Board switch to power the SIGEx board. Check that all three power LEDs are on. If not call the instructor for assistance. 7. Launch the SIGEx Main VI. 8. When you’re asked to select a device number, enter the number that corresponds with the NI ELVIS that you’re using. 9. You’re now ready to work with the NI ELVIS/SIGEx bundle. 10. Select the EXPT 11 tab on the SIGEx SFP. Note: To stop the SIGEx VI when you’ve finished the experiment, it’s preferable to use the STOP button on the SIGEx SFP itself rather than the LabVIEW window STOP button at the top of the window. This will allow the program to conduct an orderly shutdown and close the various DAQmx channels it has opened. Ask the instructor to check your work before continuing. 11-10 © 2011 Emona Instruments Experiment 11 – Poles & zeros in the Laplace domain V1.2 The experiment Part 1 – System with feedback only We will use the SIGEx model in Fig.3 . This is an implementation of the feedback system in Fig.2 Fig 3: SIGEx model of second order feedback system 11. Patch up the model as shown in Figure 3. Settings are as follows: INTEGRATION RATE: Switches to ON/ON ( k = 12,500) ADDER GAINS: a0=-0.81; a1=-0.64; a2= +1.0 FUNCTION GENERATOR: Sinewave selected, FREQUENCY=1k; Amplitude= 2V pp SCOPE: Timebase 10ms; Rising edge trigger on CH0; Trigger level=0V Special notice re nomenclature: The feedback and feedforward gains are implemented with the SFP gain controls of the dual triple-input ADDERs on the SIGEx board. We will always refer to the symbols a0, a1, a2, b0, b1, b2, as depicted in Figures 1 and 2. These symbols have been used in almost all popular textbooks over many decades. NOTE: When first wiring up this system, and after setting up the gains correctly, the output may appear “stuck” at the power supply limits eg: 10-11 V. In this case the integrator is “saturated” and needs to be discharged. To do this, briefly connect a lead from the saturated output you are viewing, to a GND terminal on the SIGEx board. This will discharge the output to 0V, and the integrator will then perform normally. Question 15 Measure and plot the gain frequency response at the output of the second integrator (x0) onto Graph 5. Confirm that this is a lowpass response similar to the theoretical predictions you obtained in prep item (Q3) (the rescaling of the frequency axis will be calculated next). Note the -3dB cut-off frequency and the frequency at which the response drops to -30dB. Measure the overshoot (if any) and note the frequency of the peak. Experiment 11 – Poles & zeros in the Laplace domain © 2011 Emona Instruments 11-11 In the theoretical preparation we had an integrator gain of unity and rad/sec as the frequency unit. Hence, to carry out the rescaling you will need to convert from rad/sec to Hz, in addition to multiplying by the integrator gain (prep item (Q14)). To convert from angular frequency, ω in rad/sec to frequency, you multiply by 2π. (Remember, 1 complete revolution, 1 cycle, 360°, is 2π radians). Since the theory had a theoretical integration rate of 1, and our real circuit integrators has an integration rate of approximately 12,500, we must multiply the frequency value by the integration rate of 12,500. This gives the scaled, non-normalised, real circuit frequency value. Although you may have already measured the actual integration rates on the SIGEx board in a previous experiment, it is worthwhile to repeat this measurement again to ensure your values are as accurate as possible. The integrator gains are readily measured by means of a balanced squarewave as input to the open loop integrator. This produces a sawtooth waveform at the integrator output (there may be a DC offset in the output; it is of no consequence in this measurement). A balanced squarewave can easily be obtained from the FUNCTION GENERATOR. Settings are as follows: FREQUENCY = 1kHz AMPLITUDE= 2Vpp DC OFFSET = 0V Select SQUARE wave output Fig 4: SIGEx model for measuring Integration Rate Fig 5: typical scope display during measurement 11-12 © 2011 Emona Instruments Experiment 11 – Poles & zeros in the Laplace domain V1.2 12. Patch together as mentioned above and view a single segment of waveform. Measure the rate of this segment, ie: rise/run as the units V/s and note here. Ensure that you use a segment of waveform which allows you to take an accurate measurement. Avoid signal segments which have reached the supply rails as these will be more difficult to measure. As well, note the exact voltage level of the input signal for the duration of the ramping signal. (In this setup it will be 1V, hence you will be dividing by 1.) Question 16 Calculate the integration rate as (rise(V)/run(s)) / input voltage (V). The units for integration rate are sec-1. Repeat your measurement for a falling ramp and confirm that the magnitudes are equal. Compute rates for all 4 switch positions in case you need this information later on. 13. Next, plot the poles of this system: apply the method in Questions 3 and 4 (you will find it convenient to calculate the poles on the basis the normalized transfer function first, and then denormalize the frequency scale in a separate step). Show the values of the real and imaginary parts, and the radius (√a0) relative to the origin of the s plane. Use the method in prep item Question 4 to estimate the magnitude response and verify that the key features match the location of the poles (eg. overshoot, bandwidth). Graph 5: poles and magnitude response Experiment 11 – Poles & zeros in the Laplace domain © 2011 Emona Instruments 11-13 14. To contrast with the lowpass response at node x0, we consider and measure the gain frequency response at node x1, the output of the first integrator. You will discover that this is a bandpass response. Question 17 Measure the frequency of the response peak, the 3dB frequencies, and hence, the 3dB bandwidth. 15. Next, we examine this response in the context of the pole-zero diagram. Briefly return to prep item (c) to obtain the transfer function for output at x1. In setting up the differential equation you will already have shown that x1 is the time derivative of x0, hence x1 = jω.x0, or s.x0. Hence the transfer function for x1 has the same denominator and poles as x0. The only difference is in the numerator, which changes to s, introducing a zero at s = 0. On the basis of the pole-zero diagram, demonstrate that the frequency response for output at x1 must be bandpass. Question 18 Calculate the geometric and arithmetic means of the 3dB frequencies. Compare this with the peak frequency. Consider which of these gives the closer agreement. This is not easy to resolve as the peak is quite flat, and pinpointing it can be challenging. It turns out that for this type of second-order system the peak is at the geometric mean of the 3dB frequencies (see Tut Q.2). Since these can be measured more accurately, this provides a better alternative for measuring the resonance frequency. From Tut Q.2 it is readily shown that this formula is not restricted to a 3dB bandwidth criterion. You may like to put this to the test, e.g. for the 6dB frequencies. Question 19 In Tut Q.2 it is shown that the bandpass response peak is at (√a0) rad/sec. Using this formula and measurement results obtain an alternative estimate of the scaling factor, and compare this with the results of the integrator gain measurements in T1.3. Consider which of these is the more reliable . Record these results for use in Tut Q.2. 11-14 © 2011 Emona Instruments Experiment 11 – Poles & zeros in the Laplace domain V1.2 16. With the setup as in section 15, keeping a1 undisturbed, vary a0, around 10 percent, and observe the effect on the resonance frequency and bandwidth. You may wish to use the manual GAIN ADJUST knob on the SIGEx board to vary each parameter in turn. Remember to setup its range to suit your parameter. (Use of the GAIN ADJUST feature is covered in the SIGEx User Manual as well as Experiment 2). Repeat this with a1, keeping a0 contant near its original setting. Satisfy yourself that a0 controls the peak frequency, without affecting the bandwidth. Likewise, observe that a1 controls the bandwidth without affecting the peak frequency. Question 20 Consider practical uses of these properties and record your comments. 17. Plot the locus of the poles corresponding to the above tests. Interpret your findings graphically in terms of the pole positions, e.g. the real part is a1/2. These considerations are explored theoretically in Tut. Q2. Graph 6: locus of poles Experiment 11 – Poles & zeros in the Laplace domain © 2011 Emona Instruments 11-15 Examining the impulse response of the LTIC system Fig 6: SIGEx model for impulse response of system Settings are as follows: PULSE GENERATOR: 400 Hz with DUTY CYCLE=0.05 (5%) INTEGRATION RATE: Switches to ON/ON ( k = 12,500) ADDER GAINS: a0=-0.81; a1=-0.64; a2= +1.0 SCOPE: Timebase 4ms; Rising edge trigger on CH0; Trigger level=1V 18. Display the output of the PULSE GENERATOR on SCOPE CH0 and x0 on SCOPE CH1. You should be able to view 1 instance of the impulse clearly. Reduce a1 to decrease the damping of the response, so that several cycles of decaying oscillation are displayed, as per Figure 7. You may wish to use the manual GAIN ADJUST knob on the SIGEx board to vary this parameter. Remember to setup its range to suit your parameter. Question 21 Record your value of a1 here as you will need it later. Measure the interval between zero crossings (or peaks) to obtain an estimate of the frequency. Record this value for comparison with a frequency domain measurement after completion of T1.8. Progressively reduce a1 further, until it reaches its minimum value of 0, and observe the effect on the decay rate of the oscillatory ("ringing") response (a0 is to remain undisturbed). Question 22 Record your observations. 11-16 © 2011 Emona Instruments Experiment 11 – Poles & zeros in the Laplace domain V1.2 Fig 7: impulse response of system for reduced a1 coefficient If slowly decaying ringing is still present with the a1 level set to 0, continue to slowly increase its value in a positive direction ie: positive gain. At some point the decaying oscillations will be replaced by sustained self oscillations. Confirm that these oscillations remain when the input is disconnected and measure the frequency. Question 23 Record your findings. 19. Measure the peak-to-peak amplitude (adjust the gain control of the scope as needed). Plot an approximate locus of the poles. Label the points at which any observations of interest occur in the shape of the response. Comment on the behaviour of the impulse response when the poles have positive real part. You may find that the onset of instability does not occur exactly at the value of a1 that you would expect from theory. Consider practical issues that may cause this. Experiment 11 – Poles & zeros in the Laplace domain © 2011 Emona Instruments 11-17 Graph 7: pole locus with varying a1 coefficient Question 24 Return to the setup in Fig. 3 and with a0 back to the same position as in step 18, recorded in Q21, measure the resonance frequency at point x1 (the bandpass filter output). Compare this result with the time domain frequency measurements of the impulse response oscillations. 11-18 © 2011 Emona Instruments Experiment 11 – Poles & zeros in the Laplace domain V1.2 Part 2 – Feedback and feedforward In this Part we experiment with ideas introduced in prep items Q10-13. 20. Using the model of Fig. 3 that you patched up in Part 1, use the “b” ADDER on the SIGEx board to implement the feedforward gains b2, b1, b0 as follows: [b2, b1, b0] = [1, 0, 2] [a2, a1, a0 = [1, -0.64, -0.81] INTEGRATION RATE: DIPs set to UP:UP b2 x2 b1 x1 b 2 x0 b0 y u -a1 -a 0 Figure 8: schematic of 2nd order integrator feedback structure with feedforward combiner (from preparation section of experiment) Fig 9: SIGEx model of second order feedback system Experiment 11 – Poles & zeros in the Laplace domain © 2011 Emona Instruments 11-19 21. Measure the gain response at y and compare with the results in prep Questions 10-12. Note that this response is lowpass. The zero at j1.41 produces a null at this frequency. Compare this response with the allpole response of x0 obtained in Part 1. In particular, examine the trade-off between depth of attenuation in the stopband and cut-off rate in the transition band. Confirm the frequency of the null. Plot the response on Graph 8. Graph 8: response Question 25 Decrease b0 progressively and observe that this causes a reduction of the gain at low frequencies. Continue until the gains at low and high frequencies are close to equal. You may wish to use the manual GAIN ADJUST knob on the SIGEx board to vary this parameter. Remember to setup its range to suit your parameter. Check that the null is still present. This realizes a bandstop filter, also known as a "notch" filter. Measure b0 (and a0 in case it was altered). Verify that b2 is still set to unity. 11-20 © 2011 Emona Instruments Experiment 11 – Poles & zeros in the Laplace domain V1.2 Question 26 Show that this response is obtained when b0 = a0 (with b2 = 1). This can be done quickly using Eqn 3 in prep Question 9: at low frequency, substitute s = 0; at high frequency use 1/s = 0. Question 27 From prep Question 11 we expect the deepest notch when b1 is zero. Examine whether this is the case in your implementation. Vary b1 above and below zero and find the value that gives the deepest notch. Suggest why there may be a discrepancy between theory and practice. Check the integrator gain by comparing theoretical and measured values of the null frequency. Consider possible practical causes for any discrepancies. Question 28 Select a different integrator constant: suggested dip switch position DOWN UP (i.e k around 29,000/s) and measure the new null frequency. Experiment 11 – Poles & zeros in the Laplace domain © 2011 Emona Instruments 11-21 The ALLPASS circuit 22. Using the same model of Fig.8 that you patched up in Part 2, restore the ADDER gains as follows: [b2, b1, b0] = [1, 0, 2] [a2, a1, a0 = [1, -0.64, -0.81] INTEGRATION RATE: DIPs set to UP:UP Gradually vary the b1 value from 0 in a negative direction and observe the depth of the notch decrease. Continue until there is no dip. Carefully trim b1 for a response that is flat across the entire frequency range. You may wish to use the manual GAIN ADJUST knob on the SIGEx board to vary this parameter. Theoretically, the condition for this response ("allpass") is b1 = a1 (with b0 = a0 and b2 = 1). Suggest why the theoretical condition may not be satisfied in the hardware if there are discrepancies. Plot the poles and zeros and show graphically that the magnitude response is allpass (refer to prep item Q13), on Graph 9. Question 29 Measure and plot the phase shift vs frequency and, again compare with your expectations from the pole-zero plot, on Graph 9. Graph 8:allpass responses 11-22 © 2011 Emona Instruments Experiment 11 – Poles & zeros in the Laplace domain V1.2 Viewing frequency responses using FFT Having measured several responses by taking individual single frequency measurements, you can understand that it is worthwhile implementing a more automated methodology for viewing system responses across a spectral range. By using a multi-frequency input signal one can view the output of a system with an FFT display and see the complete frequency response of the system. A suitable input signal is a pseudo-noise signal with a flat spectrum at the frequencies of interest. This signal was investigated in a previous experiment (Experiment 9) and so will not be discussed in detail here. Figure 10: example output spectrums for feedback and feedforward system with multi-frequency input signal 23. Patch together the input noise signal as shown in Figure 11 and view the output of the system with the scope, by using the scopes FFT display. Settings are as follows: PULSE GENERATOR: Frequency = 30kHz, Duty cycle=0.5 (50%) TUNEABLE LPF: Corner frequency set to approx. 3kHz SCOPE: Timebase : 100ms Figure 11: SIGEx model for a multi-frequency, flat spectrum signal source. TUNEABLE LPF Fc generally set to 10-15% of CLK frequency for flat response 24. Repeat several of the previous exercises with this method and compare your observations with your previous findings. You will find the exercises involving the use of the Experiment 11 – Poles & zeros in the Laplace domain © 2011 Emona Instruments 11-23 GAIN ADJUST knob to be particularly interesting and dynamic, as you can explore the interaction of parameters in real time. Switch to TAB “ZOOM FFT” for a more detailed display of the time & frequency domains. Part 3 – Critical damping & maximal flatness You may have come across the terms "maximally flat" and "critically damped". To explore these ideas we return to the allpoles lowpass filter used in Part 1. Although the feedforward subsystem is not required, there is no need to alter the setup you have been using in Part 2 as we will be ignoring the feedforward output. Notice that the feedforward section has no impact on the performance of the feedback section. 25. Set the “a” ADDER gains as for Part 1 of this experiment, as follows: [a2, a1, a0] = [1, 0.64, -0.81]. Display the lowpass output x0, and carry out a quick scan of the gain response with the FUNCTION GENERATOR set to a sinewave output. Note the significant overshoot at the high end of the passband. Gradually vary the a1 gain control and watch the reduction in overshoot. Continue until the overshoot is barely observable. Don't forget to check for any variation of input amplitude that may affect your observations. Question 30 Record the values of a0 and a1 that realize this outcome. This response is known as maximally flat. In Tut Q.8 you are invited to show that the formula for a maximally flat second order allpole is a1 = √(2.a0). 26. Critical damping is a condition that pertains to the step response. To generate a step response we use a low frequency squarewave as input from the PULSE GENERATOR. Settings are as follows: PULSE GENERATOR: 400 Hz with DUTY CYCLE=0.5 (50%) INTEGRATION RATE: Switches to ON/ON ( k = 12,500) ADDER GAINS: a0=-0.81; a1=-0.64; a2= +1.0 SCOPE: Timebase 400us/div; Rising edge trigger on CH0; Trigger level=1V Display x0 and the input squarewave and observe the overshoot in x0. Progressively increase a1 until the overshoot is barely observable. You may wish to use the manual GAIN ADJUST knob on the SIGEx board to vary this parameter. Remember to setup its range to suit your parameter. 11-24 © 2011 Emona Instruments Experiment 11 – Poles & zeros in the Laplace domain V1.2 Figure 12: example underdamped and critically damped step responses Question 31 Record the values of a0 and a1 that realize this outcome. This response is known as critically damped. It is of interest in control systems as it realizes the most rapid risetime without overshoot. This idea also finds application in the context of Gaussian filters. Further exploration of critical damping is provided in Tut. Q.9. Experiment 11 – Poles & zeros in the Laplace domain © 2011 Emona Instruments 11-25 Tutorial questions Q1 From prep item (c): determine the position of the pole p1 in terms of the coefficients a0 and a1, i.e., show that with p1 expressed in polar form p1 = ρ.exp(j.θ), we have ρ = sqrt(a0) and cos(θ) = a1/2 ρ Q2 Allpole bandpass filter: a. Derive the transfer function and squared magnitude response formula for the second order resonator in Fig. 1. Obtain the conditions for the poles to be complex valued; show this graphically, i.e., on a plane with axes a0 and a1. b. Show that there is a magnitude response peak at w0=sqrt(a0) (hint: save time and effort: use the reciprocal of the response formula; manipulate this to reveal a simple and quick method without differentiation!). c. In the Lab you discovered that a0 tunes the resonance frequency, and a1 controls the bandwidth with almost no interaction. Confirm this serendipitous property analytically (hint: the result in part a of this question). d. Derive the 3dB points and show that the bandwidth is given by a1(subject to conditions for complex poles being satisfied). Show that the product of the 3dB frequencies is equal to the square of the resonance frequency w0 (i.e.,equal to a0). Hint: inspect the simple formula that revealed the peak. Look for terms of the form (w – 1/w)2 e. Apply these results to the measurements in T1.4. Q3 State the coefficient conditions to realize an allpass. It would be useful to have an allpass realization in which the values of a0 and b0, and of a1 and b1 are implemented by single controls, respectively. Show how Fig 2 can be modified to achieve this. Indicate a possible practical difficulty with this idea (Hint: refer to your findings in T2.7). Q4 Obtain the theoretical phase and group delay responses for the allpass in T2.7. Q5 As mentioned in T2.6, switched-capacitance filters (SCF) are used in the SIGEx TUNEABLE LOWPASS FILTER. Find out how this works and explain how the tuning is implemented in this module. Q6 What is an elliptic filter? Explain how to use the structure in Fig 2 to implement elliptic filters. What is the required value of b1? Q7 Show how the system in Fig. 2 can be used to implement a tuneable notch with a single tuning control. Indicate applications of notch filters Q8 Derive the conditions for a maximally flat allpole 2nd order LPF (i.e., transfer function, and poles). Q9 Derive conditions for critical damping; does critical damping of the impulse response occur at the same pole values as for step response? Q10 (optional) In this exercise we consider the application of poles and zeros in the design of a fourth order BPF as a cascade of two biquad sections (Fig. 2). Suppose a centre frequency of 0.9 rad/s is specified. The design is to provide two zeros on the j axis, one above the passband, one below. 11-26 © 2011 Emona Instruments Experiment 11 – Poles & zeros in the Laplace domain V1.2 a. Plot a suitable pole zero constellation. Estimate the pole positions so that the bandwidth is around 0.1 rad/s. To achieve a flat passband the poles should be slightly offset ("staggered "). Note that if they are too far apart, an excessively deep trough will result. To estimate the overall magnitude response, plot estimates of the individual biquad responses on a dB gain scale. Use the results obtained in T2.2 as a guide. Note that one section will be lowpass and the other highpass. Students with access to four LAPLACE modules are encouraged to try this at the lab bench. You will find it very helpful to exploit the orthogonality of a0 and a1 (see Q2) as you trim your design. Adjust the placement of the zeros to achieve a practical balance between width of transition bands and depth of attenuation in the stopbands. b. Note that there are two pole zero pairings available, low pole with high zero, and viceversa. The usual criterion for the choice is dynamic range, ie. avoiding large peaks. Which is the best pairing? c. Suppose the specification had called for a bandwidth of 0.02 rad/s. Consider the practical challenges faced by the designer. One of these is dynamic range at internal nodes. Estimate the selectivity that could be realistically achieved with SIGEx LAPLACE modules using the structure in Fig 2. Indicate your reasons. Other biquad structures are available for consideration. These can be found in standard textbooks. d. Show a fourth-order system realized as a single stage of the form of Fig. 2. List practical issues that should be considered in comparing an implementation of the above filter as a single stage versus cascaded biquads. Experiment 11 – Poles & zeros in the Laplace domain © 2011 Emona Instruments 11-27 11-28 © 2011 Emona Instruments Experiment 11 – Poles & zeros in the Laplace domain V1.2 Experiment 12 – Sampling and Aliasing Achievements in this experiment You will be able to intuitively visualize the spectrum of a sampled signal, and aliasing. You will be able to use this to gain an intuitive understanding of sampling theorems for minimum sampling rates. Preliminary discussion The conversion of analog signal to digital format involves two stages: - first, the capture of "frozen" sample values - then, the digitization of these frozen analog values Further processing may be applied to improve the storage efficiency, ie, to reduce the memory needed to a minimum. In this lab we are concerned only with the sampling process. It is evident that the choice of sampling rate is the paramount issue: Too slow means that some details are lost with samples too far apart. If the sample spacing is too fine, resources are wasted, i.e. storage and processing time. A suitable balance between these considerations is needed. You will start with the sampling of some typical signals, then observe the recovery of the continuous-time signals from sample sequences at various rates. From this you will be able to discover the link between the minimum sampling rate and bandwidth. This lab opens the door to gaining an intuitive understanding of the theory and practical issues underlying sampling. In Part 1 you set up sampling operations of selected test signals and carry out observations in the time domain. Next, you investigate the reverse process, recovering the analog signal, and examine the effect of various sampling rates. In Part 2 you retrace the time domain investigations of Part 1 with observations in the frequency domain. This provides a systematic structure for the processes involved and makes possible intuitive mathematical interpretation. Equipped with this insight, you will be able to easily formulate criteria for choosing efficient sampling rates. 12-2 © 2011 Emona Instruments Experiment 12 – Sampling and Aliasing V1.2 Pre-requisite work Question 1 Look up or derive the trigonometric identity for the product of two sines expressed as a sum. Confirm that the frequencies in this sum are (f1 + f2) and |f1 - f2|, where f1 and f2 are the input frequencies. Confirm that the output components are of equal magnitudes. Question 2 Look up or derive the Fourier series of a squarewave of duty ratio other than 50% (25% and 1% say). Note the sinx/x shaped spectrum envelope. Locate the frequency of the first null of the envelope for each case and note the relationship with the pulse width. Now consider the 50% duty ratio case. Comment on the disappearance of the even harmonics. Question 3 Derive the spectrum of the product of a sinewave and a 1% duty ratio squarewave. You can do this easily by using superposition with the results in Question 1 and Question 2. For convenience, make the frequency of the squarewave around five times the sinewave frequency. Plot the resulting spectrum. Experiment 12 – Sampling and Aliasing © 2011 Emona Instruments 12-3 Equipment PC with LabVIEW Runtime Engine software appropriate for the version being used. NI ELVIS 2 or 2+ and USB cable to suit EMONA SIGEx Signal & Systems add-on board Assorted patch leads Two BNC – 2mm leads Procedure Part A – Setting up the NI ELVIS/SIGEx bundle 1. Turn off the NI ELVIS unit and its Prototyping Board switch. 2. Plug the SIGEx board into the NI ELVIS unit. Note: This may already have been done for you. 3. Connect the NI ELVIS to the PC using the USB cable. 4. Turn on the PC (if not on already) and wait for it to fully boot up (so that it’s ready to connect to external USB devices). 5. Turn on the NI ELVIS unit but not the Prototyping Board switch yet. You should observe the USB light turn on (top right corner of ELVIS unit).The PC may make a sound to indicate that the ELVIS unit has been detected if the speakers are activated. 6. Turn on the NI ELVIS Prototyping Board switch to power the SIGEx board. Check that all three power LEDs are on. If not call the instructor for assistance. 7. Launch the SIGEx Main VI. 8. When you’re asked to select a device number, enter the number that corresponds with the NI ELVIS that you’re using. 9. You’re now ready to work with the NI ELVIS/SIGEx bundle. 10. Select the EXPT 12 tab on the SIGEx SFP. Note: To stop the SIGEx VI when you’ve finished the experiment, it’s preferable to use the STOP button on the SIGEx SFP itself rather than the LabVIEW window STOP button at the top of the window. This will allow the program to conduct an orderly shutdown and close the various DAQmx channels it has opened. Ask the instructor to check your work before continuing. 12-4 © 2011 Emona Instruments Experiment 12 – Sampling and Aliasing V1.2 Experiment Part 1: through the time domain 11. In this exercise we observe the sampling of a sinewave. Patch up the model in Fig 2. Fig 1: block diagram for sampling with narrow pulses Fig 2: SIGEx model for sampling with narrow pulses The sampling signal is obtained from the FUNCTION GENERATOR square wave output which is set up specifically to drive the MULTIPLIER block like a switch. When the sampling signal is non-zero, ie at 1V, the input sinewave is passed. However when the sampling signal is zero volts, then the input signal is not passed, and 0V is output. This emulates an open/close switch. Settings are as follows: FUNCTION GENERATOR: Squarewave selected; 10kHz; 1Vpp, 0.50V Offset, with DUTY CYCLE=50% SCOPE: Timebase 2ms; Rising edge trigger on CH0; Trigger level=0V ANALOG OUTPUT (DAC-1): 4Vpp sinewave at 1kHz 12. View the sinewave input to the MULTIPLIER on CH0, and the sampling signal at the MULTPLIER on CH1. Confirm that they are as expected. 13. Display the analog input and the output sampled at 10,000 samples/sec. Try one or two other sampling rates and various DUTY CYCLES settings. These parameters are controlled from Experiment 12 – Sampling and Aliasing © 2011 Emona Instruments 12-5 the FUNCTION GENERATOR instrument panel. Slippage between signals will occur due to lack of synchronisation between signals. This demonstration of the sampling process is evocative because it makes it possible to view the samples as we imagine them, as individual narrow pulses with amplitude proportional to the sample value, over the entire width of the pulse. However in most applications further processing will be involved, such as encoding this sampled level as a digital representation (i.e., analog-digital conversion). Hence the sampled value must be held while this is carried out. A sample-and-hold device is provided in the DISCRETE-TIME section of the SIGEx board. 14. Repeat step 13 using sample and hold. Refer to Fig 4 for the SIGEx model. Compare the outcome with step 13 . Fig 3: block diagram for sampling with full width pulses (using Sample/Hold) Fig 4: SIGEx model for sampling with full width pulses (using S/Hold) Fig 5: example signals from SIGEx model of Fig 2 & 4 12-6 © 2011 Emona Instruments Experiment 12 – Sampling and Aliasing V1.2 Next we consider the recovery of the original analog waveform from the sample train. We will use a lowpass filter to smooth out the jagged corners of the stepped signal generated with the Sample/Hold. This has a good chance of succeeding when variations between samples are relatively small. Fig 6: block diagram for recovering the analog signal 15. Attempt the recovery of the analog signal from the stepped sample train from the SAMPLE/HOLD by means of the TUNEABLE LOWPASS FILTER (Fig 7). Set the Fc tuning knob to full clockwise. Set the GAIN to give a gain of 1 (knob at mid-range). Start with a high sampling rate, 10k samples/sec, say. Display the filter output and observe the effect of reducing the filter bandwidth. Compare this output with the original unsampled signal. 16. Since the sample rate is set by the clock signal, we will interchangeably refer to the sampling rate as a clock rate, and use the unit “Hz” rather than “samples/sec”. Question 4 Repeat this for a few other sampling rates, from 10000Hz, down to 2000Hz, say. Document your readings in Table 1 below. From these observations, what is the minimum sampling rate you consider adequate to allow recovery of the analog signal without too much distortion, on the basis of this sampling format (i.e. using the SAMPLE/HOLD function). Table 1: sample rate readings for recovery from S/H Sample rate (Hz) Experiment 12 – Sampling and Aliasing TLPF setting (approx.position) Recovered amplitude (V) © 2011 Emona Instruments 12-7 Question 5 Repeat the procedures in step 15 for recovery using the TUNEABLE LPF using the sample train generated with the system in Fig 2, i.e. with narrow pulses. Document your readings in Table 1 below. Compare the outcome with those obtained with the S/Hold method. Do you expect one of these sample formats to be better for interpolation to analog form? Is this borne out by your results? Table 2: sample rate readings for sampled pulse train recovery Sample rate (Hz) 17. TLPF setting (approx.position) Recovered amplitude (V) Leave the TLPF Fc control set as per the last few results, for the next few questions. Question 6 Examine the step and impulse responses of the filter at the settings that give you the best outcomes. Measure risetime and related properties and compare with the sample interval. 1 Use the PULSE GENERATOR module set to 10Hz, and various DUTY CYCLES settings to achieve this easily. Question 7 For the same settings as in step 17, carry out a quick examination of the frequency response of the filter. Obtain and record the 3dB cut-off frequency, and the attenuation of the stop-band. 1 You may wish o refer back to your notes from “Experiment 3: Special signals”, where step and impulse responses were covered. 12-8 © 2011 Emona Instruments Experiment 12 – Sampling and Aliasing V1.2 As we have already seen, the sinusoid has a special role in linear systems. It turns out that the sampling properties of sinewaves make it possible to establish precise limits for sampling rates. This is developed thoroughly in Part 2. 18. Carefully observe the result when the sampling rate is less than two samples per period (e.g. less than 2kHz). The frequency of the sinewave recovered at the filter output will have changed (use the filter output as trigger source for the scope). The recovered signal is not the sinewave at the input of the sampler. This is easily achieved by slowly decreasing the FREQUENCY setting of the FUNCTION GENERATOR. Using the “down arrow” to slowly decrement frequency works well. Check that this outcome occurs with both sampling formats. One way to see how this comes about is to plot the sample points on graph paper and draw a smooth curve through these points by eye. The new sinewave is called an alias of the original. The effect is known as aliasing. Try this below for a sampling rate much less than 2kHz, say 1500Hz. Draw 4 cycles of the 1kHz sinewave as a reference on Graph 1 below. Graph 1: alias waveforms Confirm that the sum of the original and alias frequencies = sampling frequency. Insight into these outcomes is best achieved from a frequency domain perspective. Experiment 12 – Sampling and Aliasing © 2011 Emona Instruments 12-9 Part 2: through the frequency domain In Part 1 we examined sampling and reconstitution through observations in the time domain. However, the mathematical structure underlying these processes is more readily revealed in the frequency domain. In the next task we examine the spectrum of the product of two sinewaves. This will be needed later as a tool for analyzing the spectrum of sampled signals. Patch together some blocks as shown in Figure 7. Figure 7:block diagram for product of two sinewaves 19. Set the FUNCTION GENERATOR frequency to 5 kHz. Display the MULTIPLIER output as well as the lower frequency input sinewave from ANALOG OUTPUT: DAC-1. Settings are as follows: FUNCTION GENERATOR: Sine wave output, 2Vpp; 0V offset. SCOPE: Timebase: 4ms; Ch0: DAC-1 ; Ch1: MULTIPLIER output The two lines straddling the FUNCTION GENERATOR frequency are clearly displayed. Confirm that the outcome agrees with the theoretical predictions in Pre-lab preparation Q1. This is an important fundamental result which you must be familiar and comfortable with. Next, the spectrum of the sampled sinewave. 20. Keep this patching but change the signal type output from the FUNC OUT terminal of the FUNCTION GENERATOR to recreate the patching of the sampled sinewave from Figure 2. Settings are again as follows: FUNCTION GENERATOR:Squarewave output; 5kHz; 1Vpp, 0.50V Offset, with DUTY CYCLE=50% SCOPE: Timebase 4ms; Rising edge trigger on CH0; Trigger level=0V ANALOG OUTPUT (DAC-1): 4Vpp sinewave at 1kHz 21. Disconnect the scope lead from the MULTIPLIER output and use it to view the sampling squarewave only. Confirm you understand why its spectrum is a series of odd numbered harmonics, including a DC component. This was covered in Pre-lab preparation Q2. 22. Reconnect the scope lead to the MULTIPLIER output and view the sampled sinewave along with the sampling squarewave. Observe the spectral lines straddling each of the squarewaves harmonics. Each one of these harmonics is straddled by a sum and difference signal. Satisfy yourself that each of these sinewave components can be considered as being separately multiplied by the sampler input, i.e. the 1kHz sinewave. Thus, by focusing on just one Fourier component of the squarewave pulse train in turn, we are able to build the array of line 12-10 © 2011 Emona Instruments Experiment 12 – Sampling and Aliasing V1.2 pairs of the form observed earlier, each pair centered at the respective harmonics of the FUNCTION GENERATOR squarewave frequency. Confirm you understand completely why the spectrum looks like this. Question 8 Explain why the sampled signal spectrum looks the way it does and specifically relate this to your understanding of pre-lab preparation item 1 & 2. In Prep Q2 you showed that the squarewave signal can be expressed as a Fourier Series, i.e. as the weighted sum of sinewaves (in this instance at 5kHz, 15kHz,...) for a 50% duty cycle signal. Vary the duty cycle of the squarewave by changing the DUTY CYCLE value in the FUNCTION GENERATOR control panel to 25%. Satisfy yourself that you understand the source for the appearance now of even harmonics also. Question 9 Note the frequency of the first and second nulls in the spectrum and explain why they are at those frequencies. Experiment with the duty cycle and view the effect of other duty cycles upon the spectrum. Try using a 10% sampling duty cycle. Confirm with your theoretical understanding. Aliasing and the Nyquist rate In the next tasks we revisit the investigation in step 18, where aliasing was discovered at sampling rates below a critical limit. The view through the frequency domain reveals a straightforward mathematical interpretation. Once again we will use the FUNCTION GENERATOR to generate the sampling clock. Whilst we are mainly interested in the frequency display, in the time domain scope display some clock slippage will be visible but is not of concern. With the same patching as before in the previous step (Figure 7), select a 25% duty cycle so as to have both odd and even harmonics present: Settings are again as follows: FUNCTION GENERATOR:Squarewave output; 5000 Hz; 1Vpp, 0.50V Offset, with DUTY CYCLE=25% SCOPE: Timebase 20ms; Rising edge trigger on CH0; Trigger level=0V ANALOG OUTPUT (DAC-1): 4Vpp sinewave at 1000Hz. View on CH1 Selecting a time base of 20ms allows us to have higher resolution in the frequency domain and see the harmonics more closely, although the individual samples in the time domain display are more difficult to discern. 23. Begin with a sampling rate of 5kHz, which is 5 samples per period of the 1kHz sinewave. Display the spectrum of the sampled output (on CH1) as well as the spectrum of the sampling Experiment 12 – Sampling and Aliasing © 2011 Emona Instruments 12-11 pulse train (on CH0). Now progressively reduce the sampling rate in 500Hz steps ie 4500Hz, 4000Hz, 3500Hz, and observe the effect on the spectrum. Carefully keep track of the positions of the spectrum images about each harmonic of the sampling clock. Note that the only component that is not shifting is the one at 1000 Hz, corresponding to the input sinewave. Use RUN /STOP to hold the time domain display if slipping. 24. When you have reduced the sampling rate to 3000Hz, locate the component adjacent to the one at 1000Hz. It should be at 2000Hz. We denote this component as the lower sideband of the first spectrum image. (The upper sideband of the first spectrum image is at 4000Hz). Continue reducing the sample rate and carefully follow the further movement of this component. Note the sample rate when the lower sideband is at the same frequency as the input sinewave. Question 10 At what sampling rate does the lower sideband of the first spectrum image become located at the same frequency as the input sinewave ? 25. Proceed further, to 1500Hz say, and note that the first lower sideband is now at a frequency below that of the input sinewave. Examine the overall spectrum and check that you are able to identify the pairing of the sidebands about their respective mirror frequencies. Note that the image patterns/pairs are now overlapping. 26. Proceed to 1000Hz . Now note that the output also contains a DC component. If you were sampling at the exact rate of the input signal, and were exactly in phase as well (something we are not able to due to slippage between the sampling pulses and the input) then you would expect to sample the sinewave at the exact same point in each period, resulting in a DC output. Consider this especially in relation to the frequency domain display you have. Now that we have seen the effect of the sample rate on the spectrum of the sampled sinewave, we are ready to focus on the recovery of the analog input with a lowpass filter as examined in step 3 and 4. We will watch the spectrum of the filter input and output as the cut-off frequency is tuned to suppress the unwanted components, and discover the challenges that arise as we strive for the lowest achievable sampling rate. 27. Add the TUNEABLE LPF to the experiment setup as shown in Figure 6. Display the spectrum at the TUNEABLE LOWPASS FILTER output. Set the sampling frequency back up to 5kHz and the TUNEABLE LOWPASS FILTER cut-off to the highest available (Fc knob fully clockwise). Set the TUNEABLE LPF GAIN to approximately 1 (mid position). Progressively reduce the TUNEABLE LOWPASS FILTER cut-off so that all components of the sampled spectrum are suppressed except one. Note its frequency and compare this with the spectrum of the sampled signal. Satisfy yourself that this is as expected. Repeat this with the FUNCTION GENERATOR at 1500Hz. Again, compare the result with the spectrum of the sampled signal and verify the validity of the outcome. Why is the original analog signal not recovered in this case? Why is the term alias is used to describe this non valid output? Question 11 12-12 © 2011 Emona Instruments Experiment 12 – Sampling and Aliasing V1.2 You should be able to recover a clean sinewave. What is its frequency ? Where does it come from? In the next segment we look for the lowest sampling rate that allows proper recovery of the input sinewave without generating alias components. 28. Return to the setup at the start of step 13. Decrease the sampling rate to 2000Hz and tune the TUNEABLE LOWPASS FILTER as before. Continue reducing the sampling rate and retuning the TUNEABLE LOWPASS FILTER until the filter can cleanly resolve the desired input component at 1000Hz, but not reduce its amplitude. We are trying to isolate the wanted component alone and separate it from the unwanted “images”. Note the sampling rate corresponding to this situation, and the frequency of the first unwanted sideband. Satisfy yourself that this frequency corresponds to the lower edge of the stopband of the filter and that the edge of the passband is at 1000 Hz. Consider how the sampling rate could be decreased further if a filter with tighter transition band was available. In theory, an ideal “brickwall” filter is needed to achieve ideal results. We will have to make do with the capabilities of the TUNEABLE LPF. Check the SIGEx User Manual to inform yourself about its performance characteristics. Question 12 Why is it not possible to recover the analog input when the number of samples per cycle of the input sinewave is less than two? Question 13 What is the minimum sampling rate that allows a filter to be able to recover the original sinewave signal without any other unwanted components ? Multi-frequency input spectrum Up until now we have simply worked with a single frequency input sinewave for simplicity. The sampling theorem also works with multiple component input signals such as voice or noise. You have discovered that the minimum sampling rate that can be used to recover a message correctly is twice the bandwidth of the signal to be sampled. This rate is commonly known as the “Nyquist rate”. In this section we will repeat the previous steps quickly, but with a multi-frequency input signal. This will allow us to enhance our visualisation of the sampled spectrum and the occurrence of “aliasing”. There is a two component signal available at ANALOG OUTPUT DAC-0. It has an easy to recognise “triangular” envelope. This signal is arbitrary and has been created to assist in visualisation of the sampling process. Experiment 12 – Sampling and Aliasing © 2011 Emona Instruments 12-13 Figure 8: example of a 2-component signal at DAC-0: time and frequency representation Figure 9: example of a sampled multi-frequency signal, in time and frequency domains 29. Repeat the steps 23,24,& 25 in the section above: “Aliasing and the Nyquist rate” whilst using this multi-frequency signal source. Start with a sampling rate of 10kHz to more clearly see the images. Notice how the triangular spectrum is reflected about each harmonic of the sampling signal, forming a series of spectral pairs. OPTIONAL: Uses of undersampling in Software Defined Radio This section is optional and builds upon your understanding of the sampling process. As has been seen so far, the sampling process can also be thought of as a simultaneous, multifrequency multiplying process, where the sampling waveform is a series of harmonics with decreasing amplitudes. We also know precisely what the outcome of each multiplication will be. With this in mind, we can take a closer look at the sampling theorem for lowpass signals. Rather than stating that a signal must be sampled at least at twice the rate of the highest component in that signal, it states that the signal must be sampled at twice the bandwidth of the signal in question regardless of its position in the passband. This means that signals in the passband need only be sampled a minimum of twice the signal’s bandpass bandwidth, and NOT twice the absolute frequency of the passband signal. 12-14 © 2011 Emona Instruments Experiment 12 – Sampling and Aliasing V1.2 For example, a DSBSC signal of a message with 2Khz bandwidth, at a bandpass frequency centered at 100kHz (such as is used in EMONA DATEx DSB-SC experiments) need only be sampled at 2 * 2kHz, and not 2 * 102kHz. The reason for this is important and has hopefully become evident in previous sections. The sampling process creates upper and lower sideband pairs about each harmonic of the sampler. The “Nyquist rate” limitation exists to avoid the created “pairs” overlapping each other and creating new and unknown components inside the message bandwidth. This means we can sample at frequencies lower than the passband which is less demanding of the sampling circuitry and has been utilised in contemporary wireless front-end convertors which sample directly at RF frequencies, an already demanding task. In this part of the experiment, we will firstly create a passband DSB-SC signal with a two-tone “message” signal at a “carrier” frequency of 10kHz. We will then sample this signal at greater than the 4000Hz (twice the message bandwidth of 2000Hz), but much lower than the actual maximum frequency of the passband signal itself, 11kHz multiplied by 2 ie: 22kHz. Remembering that the sampling signal can have harmonics, Fs, 2Fs, 3Fs,… should alert you to the fact that we are again simply doing a simultaneous, multi-frequency multiplication in which the smaller 10kHz component (2nd harmonic of 5000Hz) will multiply our message band down to baseband, where we can directly receive it. This is the essence of a direct down-conversion receiver in telecommunications. In effect we are carefully exploiting the “aliasing” effect which in the previous section we were careful to avoid. Notice that we need to select a sampling frequency which has an integer harmonic multiple equal to the center of the passband signal. 30. Patch together the experiment setup in Figure 10. The ANALOG OUTPUT: DAC-0 will supply the passband DSB-SC signal at 10kHz. Select the “PASSBAND” option on the SFP TAB 12 with the toggle switch. Figure 10: direct down-conversion receiver using undersampling 31. View both inputs to the MULTIPLIER. One is the passband signal, with 2 upper sideband components, and 2 lower sideband components with a total bandwidth of 2kHz. The other is the sampling signal with harmonics at DC, 5kHz, 10kHz, 15kHz visible. Experiment 12 – Sampling and Aliasing © 2011 Emona Instruments 12-15 Figure 11:examples of inputs and outputs to down-convertor in time and frequency domains Settings are again as follows: FUNCTION GENERATOR:Squarewave output; 5kHz; 1Vpp, 0.50V Offset, with DUTY CYCLE=25% SCOPE: Timebase 10ms; Rising edge trigger on CH0; Trigger level=0V 32. Remove the scope lead from the sampling signal and use it to view the output of the MULTIPLIER. Confirm that there is a small image of the “triangular” message from 0 to 1kHz ie at baseband. 33. View the input and output to the TUNEABLE LPF and gradually tune out all frequencies except for the baseband message. The characteristic “triangular” envelope of the message in the frequency domain lets us see that the signal is in fact available at baseband. There will be some modulation of the signal levels due to non-synchronisation of the sampling signal. Synchronisation is a major issue in this type of down conversion. It is also labelled “undersampling” due to the use of low sampling rates, and these techniques feature in modern Software Defined Radio and wireless systems. 34. Experiment with different sampling rates and confirm that the signals you see are in accordance with theory. Be aware of the phenonema of negative frequencies “folding” about the 0Hz point and being reflected into the positive frequency domain. This is often the source of unaccounted-for components. 12-16 © 2011 Emona Instruments Experiment 12 – Sampling and Aliasing V1.2 Tutorial questions Q1 re need for anti-aliasing filter: Explain the role of the anti-aliasing filter in the sampling process. Show that aliasing is caused by the sampling process, hence the anti-aliasing filter must be ahead of the sampler. Consider a signal of bandwidth 3.5kHz in the presence of wideband noise. The noise spectrum is uniform and has a bandwidth of 500kHz. The SNR is 30dB. The signal is sampled at 8k/s. What is the signal-to-noise-ratio (SNR) of the sampled signal if a suitable anti-aliasing filter is used. Compare this with the SNR that would be obtained if an anti-aliasing filter were not used. Q2 re trade-off: excessively sharp cut-off lowpass filters. Describe why the use of sharp cut-off anti-aliasing and interpolation lowpass filters helps achieve sampling rates close to the theoretical limit. Indicate the disadvantages of sharp cut-off lowpass filters, and the criteria for obtaining a practical compromise. Q3 re step 2 Suppose in the model of Fig 1 we were able to increase the duty cycle to the point of taking up the entire interval between samples, would this be equivalent to S/Hold ? Describe how you would implement a S/Hold device (clue: a capacitor is needed to hold the sampled analog voltage). Q4 Why is S/Hold used in practical DACs, in preference to narrow pulses? Q5 x/sinx correction Data sheets of commercial digital to analog converters mention "x/sinx" correction. Why is this needed? Experiment 12 – Sampling and Aliasing © 2011 Emona Instruments 12-17 12-18 © 2011 Emona Instruments Experiment 12 – Sampling and Aliasing V1.2 Experiment 13 – Getting started with analog-digital conversion Achievements in this experiment Practical knowledge of coding of an analog signal into a train of digital codewords in binary format using pulse code modulation (PCM), i.e., analog to digital conversion. Understanding of the decoding process, quantization issues and reconstruction of the output signal. Appreciation of the need for both bit clock and frame synchronisation . Preliminary discussion This lab introduces the basics of digital-analog signal conversion with the PCM ENCODER and PCM DECODER modules. The formatting of a PCM signal, will be examined in the time domain. Part 1 deals with encoding. The recovery of the analog signal is covered in Part 2. How did the idea of PCM Encoding come about ? Imagine you wanted to send an analog signal such as voice across a noisy channel. Naturally the received signal would be subject to a degree of additive noise, as well as other forms of signal distortion due to bandwidth limitations. It may become unrecognisable and hence useless. By converting that analog signal into packets of digital data, we are able to benefit from the high level of noise immunity inherent in digital signals. Although digital data transmission has its own issues, mainly, bandwidth limitations, we can be certain of the ability to reconstruct the message if the digital error rate is kept within limits. It should take you about 45 minutes to complete this experiment, not including the preparation to be done before the hands-on lab work. 13-2 © 2011 Emona Instruments Experiment 13 – Getting started with analog-digital conversion V1.2 Pre-requisite work PCM ENCODER basics The PCM ENCODER module converts an analog input into a stream of digital codewords. As investigated in Lab 12, the maximum allowable input bandwidth will depend on the sampling rate. The amplitude range must be matched to the input range of the encoder. If excessive, overloading will occur. If too small, noise and interference will degrade signal quality. The appropriate range is within the ± 2.5 volts range. This is specified in the SIGEx User Manual. A step-by-step description of the operation of the module follows: i. the module is driven by an external TTL clock. ii. the input analog signal is sampled periodically. The sample rate is determined by the external clock. iii. the sampling process is carried out as a sample-and-hold operation, within the module. The held output ( i.e., the amplitude of the analog signal at the sampling instant) is not available on the front panel of the module 1. iv. the PCM encoding is carried out by comparing each sample amplitude with a finite set of amplitude levels. These are distributed (uniformly, for linear sampling) within the range ± 2.5 volts. These are the system quantizing levels. v. each quantizing level is assigned a number, starting from zero for the lowest (most negative) level, with the highest number being (L-1), where L is the available number of levels. vi. each sample is assigned a digital (binary) code word representing the number associated with the quantizing level which is closest to the sample amplitude. The number of bits ‘n’ in the digital code word will depend upon the number of quantizing levels. Question 1 Show that n = log2(L): vii. the code word is assembled into a time frame together with any other bits as may be required (described below). In the PCM ENCODER (and many commercial systems) a single extra bit is added, in the least significant bit position. This is alternately a one or a zero. These bits are used for frame synchronization in the decoder. viii. the frames are transmitted serially. They are transmitted at the same rate as the samples are taken. The serial bit stream is accessible on the front panel of the module. 1 Sampling with a sample and hold operation is introduced in Lab12 where you are able to display the "held" output.The PCM ENCODER effectively has a “sample and hold” unit within its front end. Experiment 13 – Getting started with analog-digital conversion © 2011 Emona Instruments 13-3 ix. also available from the module is a synchronizing signal FS (‘frame synch’). This signals the end of each data frame. Before proceeding with the experiment tasks, we briefly review the essential features of the ENCODER module. Figure 1:Layout of the PCM ENCODER The SIGEx board layout of the module is shown in Figure 1. Technical details are described in the SIGEx User Manual. Familiarize yourself with the purpose of each of the input and output connections, and the three-position toggle switch. Counting from the top, these are: • FS: frame synchronization, a signal which indicates the end of each data frame. • Vin:: the analog signal to be encoded. • PCM DATA: the output data stream, the examination of which forms the major part of this experiment. • CLK: this is a TTL (red) input, and serves as the MASTER CLOCK for the module. Clock rate must be 20 kHz or less. For this experiment you will use a 10kHz TTL signal from the PULSE GENERATOR module. PCM time frame Each binary word is located in a time frame. The time frame contains eight slots, with one clock period per slot. These slots hold the bits of a binary word, numbered 7 through 0, from first to last. The least significant bit (LSB) is contained in slot 0. 13-4 © 2011 Emona Instruments Experiment 13 – Getting started with analog-digital conversion V1.2 Equipment PC with LabVIEW Runtime Engine software appropriate for the version being used. NI ELVIS 2 or 2+ and USB cable to suit EMONA SIGEx Signal & Systems add-on board Assorted patch leads Two BNC – 2mm leads Procedure Part A – Setting up the NI ELVIS/SIGEx bundle 1. Turn off the NI ELVIS unit and its Prototyping Board switch. 2. Plug the SIGEx board into the NI ELVIS unit. Note: This may already have been done for you. 3. Connect the NI ELVIS to the PC using the USB cable. 4. Turn on the PC (if not on already) and wait for it to fully boot up (so that it’s ready to connect to external USB devices). 5. Turn on the NI ELVIS unit but not the Prototyping Board switch yet. You should observe the USB light turn on (top right corner of ELVIS unit).The PC may make a sound to indicate that the ELVIS unit has been detected if the speakers are activated. 6. Turn on the NI ELVIS Prototyping Board switch to power the SIGEx board. Check that all three power LEDs are on. If not call the instructor for assistance. 7. Launch the SIGEx Main VI. 8. When you’re asked to select a device number, enter the number that corresponds with the NI ELVIS that you’re using. 9. You’re now ready to work with the NI ELVIS/SIGEx bundle. 10. Select the EXPT 13 tab on the SIGEx SFP. Note: To stop the SIGEx VI when you’ve finished the experiment, it’s preferable to use the STOP button on the SIGEx SFP itself rather than the LabVIEW window STOP button at the top of the window. This will allow the program to conduct an orderly shutdown and close the various DAQmx channels it has opened. Experiment 13 – Getting started with analog-digital conversion © 2011 Emona Instruments 13-5 The experiment We are now ready to proceed. Note that the PCM ENCODER is the only module used in Part 1. It is not necessary to become involved with how the PCM ENCODER module achieves its purpose. What will be discovered is what it does under various conditions of operation. PCM encoding and quantisation Examination with DC input We begin with some basic aspects of the analog to digital conversion process. For this purpose we will use a constant (DC) analog input. This ensures completely stable oscilloscope displays, and enables easy identification of the quantizing levels. 11. Patch the PCM ENCODER as shown in Figure 2. Figure 2:patching diagram for PCM ENCODER Settings are as follows: PULSE GENERATOR: 10,000 Hz with DUTY CYCLE=0.5 (50%) SCOPE: Timebase 2ms; Rising edge trigger on CH0; Trigger level=1V Zero input to PCM ENCODER 12. connect the PCM INPUT terminal to a GND terminal on the SIGEX board. 13. display FS on CH0. Adjust the timebase to show three frame markers. These mark the end of each frame, that is, the last bit of the frame. 14. display the CLK signal on CH1. Question 2 Record the number of clock periods per frame. 13-6 © 2011 Emona Instruments Experiment 13 – Getting started with analog-digital conversion V1.2 Question 3 Currently the analog input signal is zero volts (since INPUT is grounded). Before checking with the scope, consider what the PCM encoded output might look like. Can you assume that it will be 00000000?. What else might it be, bearing in mind that this PCM ENCODER outputs offset binary format. Question 4 On CH1 display the signal at PCM DATA output.The display should be similar to that in Figure 3 (possibly with fewer frames). Is it in agreement with your expectations? The same codeword appears in each frame because the analog input is constant. This codeword represents the 8-bit binary output number, corresponding to the zero volt analog input. Figure 3: PCM Encoder input and output signals Confirm the following three points: 1. the number of slots per frame is 8 2. the location of the least significant bit is coincident with the end of the frame 3. the binary word length is 8 bits Variable DC input to PCM ENCODER 15. remove the ground connection, and connect the INPUT to output of the ANALOG OUTPUT: DAC 1. This programmable output is set to be a VARIABLE DC voltage, which is controlled from the control on the Lab13 TAB on the SIGEX SFP. Sweep the DC voltage slowly Experiment 13 – Getting started with analog-digital conversion © 2011 Emona Instruments 13-7 backwards and forwards over its complete range, and note how the data pattern within each frame changes in discrete jumps. Question 5 Adjust VARIABLE DC to its maximum negative value. Record the DC voltage and the pattern of the 8-bit binary number. Question 6 Slowly increase the amplitude of the DC input signal until there is a sudden change to the PCM output signal format. Record the format of the new digital word, and the input DC voltage at which the change occurred. Use the INCREMENT arrows on the digital value entry box for a steady stable increase in DC value. 16. continue this process over the full range of the DC supply. Note a selection of DC voltages and corresponding binary output words in the table below. Table 1: DC VOLTAGE input vs. PCM codewords DC VOLTAGE (V) 13-8 © 2011 Emona Instruments 8 bit PCM codeword Experiment 13 – Getting started with analog-digital conversion V1.2 17. draw a diagram showing the quantizing levels and their associated binary numbers in the graph below. Graph 1:DC to binary word plot Review of the 8-bit data format Question 7 On the basis of your observations so far, provide answers to the following: * * * * * * * what is the sampling rate ? what is the frame width ? what is the width of a data bit ? what is the width of a data word ? how many quantizing levels are there ? are the quantizing levels uniformly (linearly) spaced ? what is the the minimum quantized level spacing ? How does this compare to theory ? Experiment 13 – Getting started with analog-digital conversion © 2011 Emona Instruments 13-9 Question 8 The relationship between the sampled input voltage and the output codeword has been described above. Suggest some variations of this relationship that could be useful ? Working with periodic signals In this section we consider the challenge of generating a stable display of the encoded output with a conventional scope when a periodic input signal is used. Carry out the three tasks below to see the problem. This difficulty does not arise if you have access to an instrument with signal capture capability, such as a digital scope. You can use the RUN/STOP button on the SFP to hold a single screen display of the data when necessary. In Part 2 this issue is further examined when we display the reconstructed signal at the decoder output. 18. Take a periodic signal from the ANALOG OUTPUT: DAC0 terminal. Question 9 Adjust the scope to display this waveform. Record its shape and frequency. Check whether this conforms with the Nyquist criterion. Show your reasoning. 19. Display the PCM DATA output on CH1. Again, synchronize the scope to the frame signal FS. Display two or three frames on CH1. Notice how they differ as expected. 20. Move the scope lead from the FS and view the INPUT signal on CH0. You are now viewing the input sinusoid as well as the output codeword as in Figure 4. Freeze the display occasionally (using RUN/STOP) and look at the relationship between input and output. See if you can see the pattern. 13-10 © 2011 Emona Instruments Experiment 13 – Getting started with analog-digital conversion V1.2 Figure 4: input and output from PCM ENCODER PCM decoding and reconstruction In this part we proceed with the decoding2 of the output of the PCM ENCODER to reconstitute the analog input. Before proceeding with the experiment tasks, we briefly review the OPERATION of the DECODER. PCM DECODER The operation of the PCM DECODER module is as follows: • a frame synchronization signal FS is received from the transmitter. • the binary number representing the coded (and quantized) amplitude of the sample from which it was derived, is extracted from the frame. • the quantization level represented by the input codeword is determined. • a voltage proportional to this amplitude level is generated. • this voltage appears at the output terminal OUTPUT for the duration of the respective frame. • signal reconstruction is completed by lowpass filtering, as seen in Lab 12. A built-in reconstruction filter is not provided in the module so that you can see the quantization steps in the output. The recovered signal will not be identical to the original due to quantizing. Other imperfections may be due to aliasing distortion, as already considered in Lab 12. The DECODER is driven by an external clock which must be synchronized to that of the ENCODER. It is possible to “embed” the frame sync signal into the data, but this feature is outside the scope of this lab and is not included in the functionality of the SIGEx board3. An alternative to automatic frame synchronization is to steal the synchronization signal, FS, from the PCM ENCODER module. Use of this signal would assume that the clock signal to the 2 it is common practice to refer to demodulation from analog signals, and decoding from digital signals. 3 This feature is available on the EMONA DATEx Telecommunications Trainer board for NI ELVIS Experiment 13 – Getting started with analog-digital conversion © 2011 Emona Instruments 13-11 PCM DECODER is of the correct phase. This is assured in this experiment, but would need adjustment if the PCM signal is transmitted via a bandlimited channel. Hence the use of embedded frame synchronization information in some systems. The front panel of the DECODER module is shown in Figure 3. Technical details are described in the SIGEx User Manual. Figure 5: Layout of the PCM DECODER The following is a summary of the input and output connections : • FS: connect an external frame sync. signal here • PCM DATA: the PCM signal to be decoded is connected here. • OUTPUT: the decoded signal. • CLK: this is a TTL (red) input, and serves as the CLOCK for the module. Clock rate must be 20 kHz or less. For this experiment you will use the same clock as used for the PCM ENCODER. Figure 6: PCM Encoding and decoding patching diagram: input from DAC 0. TLPF serves as recontruction filter 13-12 © 2011 Emona Instruments Experiment 13 – Getting started with analog-digital conversion V1.2 Decoder Experiments 21. The PCM ENCODER provides the digital input for the DECODER. Patch together as shown in Figure 7. Settings are as follows: PULSE GENERATOR: 10,000 Hz with DUTY CYCLE=0.5 (50%) SCOPE: Timebase 20ms; Rising edge trigger on CH0; Trigger level=1V TUNEABLE LPF: Fc set to max, GAIN set to max. 22. Connect CH1 of the SCOPE SELECTOR to the OUTPUT of the PCM DECODER, and CH0 to the INPUT signal at the ENCODER. Trigger the SCOPE on the INPUT signal. Your display should resemble Fig. 7. Figure 7: input and output signals The recovered analog signal & reconstruction In this section we use a periodic signal to observe the quantized appearance of the decoder sample-hold output.The internal DAC output implements a “zero-order hold” operation, in that it holds the value for a complete clock period. This has an inherent filtering effect, prior to any reconstruction filtering. The OUTPUT signal is distinctly different from the input signal. The output is only updated once every frame, hence there is a large step change between output samples. This difference is known as “sampling distortion”. As well the “granularity” of the output only having 256 possible levels will contribute some error, known as “quantizing distortion”, however, it is not easily observable with this input signal. In the previous section you will have calculated the step size due to quantization by the encoder. You can see, qualitatively, that the stepped output signal bears a resemblance to the input. We saw in Lab 12 that the use of a lowpass filter made it possible to smooth out the steps. The need for pulseshape equalization in the form of so called “x/sinx” correction was also mentioned there. Experiment 13 – Getting started with analog-digital conversion © 2011 Emona Instruments 13-13 Question 10 Momentarily, vary the clock rate from 10,000 to 20,000 Hz. How does this affect the “sampling distortion” viewable in the output signal ? An interpolation LPF is provided in the TUNEABLE LPF block. 23. Adjust the TUNEABLE LPF in the output path of the PCM DECODER to vary the filters corner frequency, and observe the reconstructed signal. Adjust the TUNEABLE LPF GAIN control to set the output signal to the same amplitude as the input. This makes the overall conversion gain equal to unity. The PCM DECODER does not have the same conversion gain as the ENCODER. Question 11 View the input to the TUNEABLE LPF, ie the output of the PCM DECODER and compare with the INPUT sinusoid. What is the gain of the PCM DECODER itself. Again viewing the output from the TUNEABLE LPF, which is acting as the reconstruction filter, slowly reduce the Fc until the steps are eliminated, and the original signal is recovered. Question 12 Can you explain the source of the delay between input and output signals ? Both with and without the TUNEABLE LPF ? Question 13 Momentarily, vary the clock rate from 10,000 to 20,000 Hz. How does this affect the required Fc needed to recover the signal without distortion ? 13-14 © 2011 Emona Instruments Experiment 13 – Getting started with analog-digital conversion V1.2 Tutorial Questions Q1 from your knowledge of the PCM ENCODER module, obtained during preparation for the experiment, calculate the sampling rate of the analog input signal. What can you say about the bandwidth of an input analog signal to be encoded ? Q2 define what is meant by the data ‘frame’ in this experiment. Draw a diagram showing the composition of a frame for the 8-bit coding scheme Q2 quantizing distortion decreases as the number of quantizing levels is increased. Explain why an excessive increase of the number of quantizing levels may incur a bandwidth penalty: describe how to manage this trade-off. Look up Shannon's formula and show how it relates to this trade-off. Explain whether this issue could be observed in this lab ? Q3 explain why a DC input provides a stable display of the PCM DATA output on a conventional scope. Why is the display ‘unstable’ when the input is a sine wave (for example) ? Q4 look up “two’s complement” encoding and find out a field of application where it is used. What is the advantage of “offset binary” encoding used in this lab? Devise or look up a method to convert from offset binary to two’s complement. Q5 carry out a brief internet search of the principles and applications of companding. Compile a summary of its advantages. Compare this with published information about the ‘A’ and ‘µ’ companding laws used respectively in Europe and the USA. Q6 two sources of distortion in the reconstructed message have been identified; they were called sampling distortion and quantizing distortion. a) assuming a sample-and-hold type sampler, what can be done about minimizing sampling distortion ? b) what can be done about minimizing quantizing distortion ? Why is “x/sinx” correction required with sample-hold interpolation? (Refer to Lab 12) Q7 describe how to determine the specification for the reconstruction filter used in the decoder ? Experiment 13 – Getting started with analog-digital conversion © 2011 Emona Instruments 13-15 13-16 © 2011 Emona Instruments Experiment 13 – Getting started with analog-digital conversion V1.2 Experiment 14 – Discrete-time structures: Finite Impulse Response (FIR) filters Achievements in this experiment You will be able to relate the response of a discrete-time (DT) FIR filter to its transfer function. You will use the zeros of the transfer function to visualize frequency responses graphically at a glance, without math. You will be able to use this knowledge to intuitively design low order discrete-time responses. You will be ready to extend this concept to recursive DT filters and to higher order applications. Preliminary discussion In Lab 11 we used poles and zeros as an intuitive aid in working with continuous-time filters. In this Lab we apply the same idea for discrete-time applications. DT filters can be implemented with or without the use of feedback. The latter filters are generally known as nonrecursive or Finite Impulse Response (FIR). The transfer function of a nonrecursive filter can be expressed as a polynomial. Since there is no denominator, there are no poles, only zeros, which makes it simpler for getting started. As with the continuous-time case, you can intuitively predict and track system responses from the zeros. The absence of feedback is an important advantage in many applications as there is no risk of unstable behaviour. This is very useful when working with adaptive filters. Serious practical realizations of FIR filters generally require a large number of delay elements. The most demanding are the bandpass. However, the notch filter works well as a two-delay FIR example. We will use this example here to examine the relationship between the frequency response and the coefficient values through the interpretation of zero positions in the z plane. 14-2 © 2011 Emona Instruments Experiment 14 – Discrete time Structures: FIR V1.2 Preparation This preparation provides essential theory needed for the lab work to make sense. Question 1 Consider the system in Figure 1, where nT are the discrete-time points, with T sec denoting the unit time delay, i.e. the time between samples. Show that the difference equation relating the output y(nT) and the input u(nT) is Y(nT) = b0.u[nT] + b1.u[(n - 1)T] + b2.u[(n - 2)T] (Eqn 1). Show by substitution that ejnTω is a solution, i.e. show that when the input is ejnTω , y(nT) is ejnTω multiplied by a constant (complex-valued); ω is the frequency of the input in radians/sec. + OUTPUT INPUT b2 b1 b0 UNIT DELAY UNIT DELAY Figure 1: schematic of FIR filter with two unit delays In Lab 11 we used a complex exponential input to represent the behaviour of a system that is supposed to operate with real-valued signals. You could consider using u[nT] = cos(nTω) or sin(nTω) instead. However, the use of the exponential function simplifies the math considerably. We have already seen that cos(ωt) is Re{exp(jωt)}, so, you can carry out the analysis with ejnTω , then simply take the real part of the result. After a while, working with complex exponential functions to represent sinusoids becomes second nature and we don't even bother thinking about taking the real part. Many practical systems implemented digitally actually operate with complex-valued signals, for example modulators and demodulators working with quadrature signals. From the above, with input u(nT) = ejnTω , show that H = y/u = b0 + b1. e-jTω + b2. e-j2Tω (Eqn 2). Note that H is not a function of n. Question 2 Use this result to obtain a general expression for the magnitude of y/u as a function of ω. You will need to first write down the real and imaginary parts. Set T = 1 sec for the time being, and plot the result for the case b0 = 1, b1 = -1.3 , b2 = 0.9025 over the range ω = 0 to 2.π rad/sec. Label the frequency axis in Hz as well as rad/sec. You should find there is a significant dip in the response near 0.13Hz. Question 3 Experiment 14 – Discrete time Structures: FIR © 2011 Emona Instruments 14-3 As in Lab 7, we consider an alternative way of getting frequency responses. We will create a graphical medium to provide an intuitive environment for visualizing and generating both magnitude and phase responses. First, return to the expression for y/u obtained in (a) and replace "exp(jTω)" by the symbol "z". Look upon z merely as a convenient macro for exp(jTω) . At this point there is no need to ascribe any deeper significance to this substitution. The result is the (complex-valued) polynomial y/u = H(z) = b0 + b1.z-1 + b2.z-2 = z-2 . [b0. z2 + b1.z + b2 ] (Eqn 3). For the case b0 = 1, b1 = - 1.3 , b2 = 0.9025 (from (Q2)), express the quadratic in the brackets in the factored form (z - z1)(z - z2), where z1 and z2 are the roots. Show that these are given by z1 = 0.95e j0.260π z2 = 0.95e -j0.260π (Eqn 4). Satisfy yourself that the magnitude response of H can be expressed as |H(ω)| = |(ejT ω - z1)|.|(ejT ω - z2)| (Eqn 5). Write down the corresponding expression for the phase of H. Question 4: Graphical plotting of poles & zeros We are now ready to proceed with a graphical approach for evaluating the factors (z - z1) and (z - z2) in Eqn 3. Place an "o" on a complex plane (we will refer to this as the z plane) at the locations corresponding to z1 and z2, as obtained in Eqn 4. With T = 1, we will get an estimate of |H| at ω = π/5. Place a dot at the point ejπ/6. Join this point and the point z1 with a straight line. The length of this line is |(ejπ/5- z1)|. Do the same with z2 to obtain |(ejπ/5 - z2)|. From Eqn 5, the desired estimate of |H(π/5)| is simply the product of the lengths of these two lines. Question 5 By repeating this for other values of ω we are able to get a quick estimate of the graph of |H| versus ω. It's important to note that the locus of ejTω is a circle of unity radius centered at the origin (known as the unit circle). Hence, the general shape of the frequency response is easily estimated by simply running a point counter-clockwise along the circumference of the unit circle, starting at (1, 0). Note that the idea is just a variant on the procedure introduced in Lab 11, where we moved the frequency point along the j axis. Compare the outcome with the result computed in (Q2). Notice that the presence of the trough in the response can be seen at a glance from the behaviour of the vector from the "zero" z1 as the dot on the unit circle is moved near z1. By comparison, the rate of change of the other vector is small over that range. Question 6 Modify Fig 1 by replacing the unit delays with a gain of 1/z and show that Eqn 3 follows by inspection using simple algebra, without the need to work through the difference equation 14-4 © 2011 Emona Instruments Experiment 14 – Discrete time Structures: FIR V1.2 step. While this is only a minor simplification in this example, it is very useful in more complicated cases, especially where feedback loops are involved. Although z was originally introduced in (Q3) as just a substitution for ejTω, our interpretation appears to have been extended in (Q4) to include any complex number. Consider whether this is the case, and why. Question 7 In the above example, we had the sample interval T = 1. Suppose T = 125 microsec. Adjust the frequency axis for this value of T. Extend this result for any value of T. How are the zeros of H(z) affected by the value of T? Why is it appropriate to use T = 1 normally? Show that |H(ω)| is periodic, and determine the period in Hz. Experiment 14 – Discrete time Structures: FIR © 2011 Emona Instruments 14-5 Equipment PC with LabVIEW Runtime Engine software appropriate for the version being used. NI ELVIS 2 or 2+ and USB cable to suit EMONA SIGEx Signal & Systems add-on board Assorted patch leads Two BNC – 2mm leads Procedure Part A – Setting up the NI ELVIS/SIGEx bundle 1. Turn off the NI ELVIS unit and its Prototyping Board switch. 2. Plug the SIGEx board into the NI ELVIS unit. Note: This may already have been done for you. 3. Connect the NI ELVIS to the PC using the USB cable. 4. Turn on the PC (if not on already) and wait for it to fully boot up (so that it’s ready to connect to external USB devices). 5. Turn on the NI ELVIS unit but not the Prototyping Board switch yet. You should observe the USB light turn on (top right corner of ELVIS unit).The PC may make a sound to indicate that the ELVIS unit has been detected if the speakers are activated. 6. Turn on the NI ELVIS Prototyping Board switch to power the SIGEx board. Check that all three power LEDs are on. If not call the instructor for assistance. 7. Launch the SIGEx Main VI. 8. When you’re asked to select a device number, enter the number that corresponds with the NI ELVIS that you’re using. 9. You’re now ready to work with the NI ELVIS/SIGEx bundle. 10. Select the Lab 14 tab on the SIGEx SFP. Note: To stop the SIGEx VI when you’ve finished the experiment, it’s preferable to use the STOP button on the SIGEx SFP itself rather than the LabVIEW window STOP button at the top of the window. This will allow the program to conduct an orderly shutdown and close the various DAQmx channels it has opened. Ask the instructor to check your work before continuing. 14-6 © 2011 Emona Instruments Experiment 14 – Discrete time Structures: FIR V1.2 Experiment Part 1 Notch filter using two-delay FIR: We will be implementing the filter in Fig. 1. Figure 2 shows the SIGEx wiring diagram. The gains b0, b1, b2 in the triple ADDER module realize the coefficients b0, b1, b2, respectively. 11. Patch up the SIGEx model in Fig. 2. Settings are as follows: ADDER gains: b0 =1.0; b1 = -1.3; b2 = 0.902 PULSE/CLK GENERATOR: 10 kHz, Duty cycle = 0.5 (50%) FUNCTION GENERATOR: 1000 Hz; 4Vpp, Sinewave output selected SCOPE: Timebase 4ms; Rising edge trigger on CH0; Trigger level=0V View the input signal on CH0, and output with CH1. Check that the time interval between samples is consistent with the clock frequency. Figure 2: SIGEx wiring model of FIR filter with two unit delays 12. Measure and plot the magnitude response over the range 300 Hz to 3kHz using the FUNCTION GENERATOR. Note that the amplitude measurement could be a little challenging at the upper frequencies due to the increasing interval between samples relative to the signal period. It is suggested you vary the timebase appropriately, and use the RUN/STOP and YAUTOSCALE buttons when necessary to achieve a stable display. Confirm that the response has a deep notch. Experiment 14 – Discrete time Structures: FIR © 2011 Emona Instruments 14-7 Graph 1:response plot Question 8 Measure the notch frequency and the depth relative to the response at DC. Also measure the time delay as a function of frequency at several points of interest. 13. Using the values of b0, b1, b2 entered, apply the method developed in the preparation section to plot the zeros of this filter in the z-plane. Check that you have the correct sign of the coefficients (the zeros should be in the right half-plane). Compare the measured frequency response with the plot of the zeros. Verify that the measured notch frequency agrees with the position of the zeros (remember, the frequency at the 180 degree point on the unit circle corresponds to f_sample/2 = 1/2T Hz). 14. Decrease the b1 gain slightly and observe the effect on the magnitude response. Measure the new notch frequency. Use this to determine the new positions of the zeros and the corresponding value of b1. Verify the agreement between measurement and theory. Question 9 Determine and note the new notch frequency, for the b1 gain entered. Document the relationship between b1 and notch frequency 14-8 © 2011 Emona Instruments Experiment 14 – Discrete time Structures: FIR V1.2 15. This time, reduce b2 gain very slightly (order of 2-3%, say) and again, observe the effect on the magnitude response. The outcome should be a reduced notch depth. Try to determine the approximate position of the zeros from the notch depth (notch depth relative to DC gain, say). Part 2 Using notch filter to eliminate interference In the next exercise we use the notch filter to remove an interference tone. Consider this practical situation: we are trying to receive a message at frequency f1 from a distant transmitter, but in our neighbourhood there is another transmitter sending an unwanted signal at frequency f2 affecting our reception of f1. 16. Keep the PULSE/CLK GENERATOR frequency at 10,000Hz and maintain the coefficients values as for Part 1 of this experiment. 17. Use the ANALOG OUTPUT as a source of signals f1 ,and f2. Add these using the “f + g” ADDER block to create f1 + f2 . Confirm that DAC-0(f1 ) = 500Hz sinusoid, and DAC-1 ( f2 ) = 1300 Hz sinusoid. 18. View each output individually as well as the sum of the outputs. View them both in the time domain as well as in the frequency domain.Show that the f2 signal can be suppressed with the notch filter. Remember that the notch is set to 1.3kHz. Question 10 What is the level of attenuation of the f2 signal for the original zero positions. 19. Vary the value of b1 slightly in each direction and notice the affect on the output. Remember that b1 controls the frequency of the notch. This is a finding from a previous part of this experiment. NOTE: To vary the value of a control slightly, set the cursor next to the digit you wish to vary and then use the UP and DOWN arrow buttons on the control. As well, the GAIN ADJUST knob on the SIGEx board itself can be used to vary by hand the coefficient value of the ADDER. Question 11 From your previous findings in this experiment, what change is required to gain b1 to reduce the notch frequency ? Experiment 14 – Discrete time Structures: FIR © 2011 Emona Instruments 14-9 20. View both the input two-tone signal on CH1 and the output signal from the notch filter on CH0. In particular, view them on the FFT display of Lab14 SFP. 21. As well, switch between the Lab 14 TAB and the PZ PLOT TAB on the SFP while making these adjustments. Notice how the zeroes move when b1 is adjusted. In particular, interpret the notch frequency from the position of the zeroes. By entering the sample clock frequency into the “clock freq” control on the PZ PLOT TAB, you can automate the calculation of the notch frequency somewhat. Ensure you understand what is being calculated. Figure: example of PZ PLOT TAB displaying a FIR structure. Zeroes only. Remember that the POLE-ZERO PLOT is an essential diagram for interpreting frequency response of a structure. Question 12 What is the equation relating theta of the zero to the frequency of the zero, as implemented in the PZ PLOT TAB ? 22. Vary the value of b1 until you eliminate the lower frequency component of the two-tone message signal. You are exploring using the selectivity of a filter through variation of its transfer function. Use both the FFT display on TAB14 and the PZ PLOT TAB during this process so you develop an appreciation for the relatedness of these two different display representations. 1410 © 2011 Emona Instruments Experiment 14 – Discrete time Structures: FIR V1.2 Figure : Notch filter set to attenuate the lower component of the message Question 13 For what value of b1 did you achieve the maximum attenuation of the lower message component RELATIVE to the higher component ? What levels did you measure ? 23. Pass the notch filter output, which is sampled and discrete, through a reconstruction filter such as the BASEBAND LPF to “clean up” the signal. Experiment again with the b1 coefficient whilst viewing the now, continuous, output signal as you select between each message component. See how “clean” a sinusoid you can recover. Experiment with attenuating both components. HINT: if using the GAIN ADJUST knob to control b1, you can set the available output range of the knob so as to be able to “fine tune” your coefficient value by hand. Question 14 What components is the TUNEABLE LPF attenuationg in order to give a “clean” signal ? Experiment 14 – Discrete time Structures: FIR © 2011 Emona Instruments 14-11 Tutorial Questions Q 1. In Eqn 4 the zeros are complex conjugates. Examine other cases in this Lab and consider whether this is a coincidence or an outcome of a general property of FIR filters. Q 2. Lowpass FIR filters are sometimes called moving average (MA) filters. Using an example, explain the reason behind this. Q 3. For the system in Prep (c) show that when b0 = b2 the zeros are on the unit circle. Plot a graph of the frequency of the zeros versus b1/b0. Tip: to fast track the math, factor out z. Interpret the result in the context of step 9. Q 4. Consider a zero at the origin of the z plane. Show that its magnitude response is constant and its phase response linear. Show that the factor z-2 in Equation (3) generates a pair of poles at the origin. What is the effect of these poles on the overall response H_y? Q5. The z plane method generates frequency responses that are periodic. Is this an artificial mathematical side effect resulting from the use of complex variables, or does this reflect reality (refer to the Lab on sampling)? Q. 6. Find the zeros for the following 4-delay FIR filters (hint: exploit the symmetry) (i) [1, 2sqrt2, 4, 2sqrt2, 1] (ii) [1, -2sqrt2, 4, -2sqrt2, 1] (iii) [1, 0, 0, 0, 1] (iv) [1, 0, 1, 0, 1] (v) [1, 0, 2, 0, 1] (vi) [1, 1, 1, 1, 1] (hint: this is a geometric progression) (vii) [1, sqrt3, 2, sqrt3, 1] State the type of filter realized in each case (lowpass/ highpass/ other). Compare cases (i) and (ii), and derive a rule of thumb for converting a lowpass FIR filter to highpass (make reference to the coefficients and to the zeros). Which of these is relevant to the implementations in step 12 and 15? Confirm that in each case the zeros are on the unit circle. Is it a coincidence, or is there a systematic property that these examples share? 1412 © 2011 Emona Instruments Experiment 14 – Discrete time Structures: FIR V1.2 Q. 7. Show that the phase responses of the filters in Q.6 are linear. Q. 8 In Prep (h) consider an alternative case: move the zeros at +/- 150deg to 180deg (the other zeros remaining fixed). What is the effect on bandwidth and attenuation in the stop band? What is the result if all the zeros are placed at 180deg? Suppose the FIR has 48 zeros. Discuss alternatives for the design of a lowpass filter: is it preferable to spread the zeros across the stopband or to place all the zeros at 180deg? Q 9. Find and plot the zeros for the coefficients in step 13. Note that the transfer function is a truncated GP. Apply this to simplify the factorization. Q 10. Write down the transfer function of a first-order continuous-time LPF. The impulse response of this filter is a decaying exponential that can be matched approximately to the unit pulse response of the FIR in step 13. Obtain the time constant and pole of the CT LPF that matches the FIR. Estimate the bandwidth of the CT filter. Compare this with the bandwidth of the FIR. Q11. Show how an analog FIR can be implemented with short equal lengths of coaxial cable as delay elements. Satisfy yourself that such a filter can be used with continuous-time inputs, i.e., without sampling. On this basis we should expect a transfer function in terms of the Laplace variable s. Obtain such a transfer function for the case in prep (b) and show that it is a quadratic in exp(-sT), where T is the delay of a cable element. Show that in order to apply the graphical method for estimating responses, a z plane representation is needed, with z = exp(sT). Filters of this kind were used with early TV systems in the 1940's. The inventor was Kalmann (not to be confused with Kalman filters in optimization theory). Q12. Consider the periodicity issue in Q5 again, in the context of Q11. Satisfy yourself that frequency responses of this continuous time system are also periodic. Experiment 14 – Discrete time Structures: FIR © 2011 Emona Instruments 14-13 1414 © 2011 Emona Instruments Experiment 14 – Discrete time Structures: FIR V1.2 Experiment 15 – Poles and zeros in the z plane: IIR systems Achievements in this experiment You will be able to interpret the poles and zeros of the transfer function of discrete-time filters to visualize frequency responses graphically at a glance, without math. You will be able to use this knowledge to intuitively design recursive/IIR discrete-time responses. Preliminary discussion In Lab 11 we discovered how poles and zeros can be used as an intuitive tool for analyzing and designing continuous-time (CT) filters. Next, in Lab 14 we examined discrete-time (DT) FIR filters and found the same ideas could be applied there. The complex "s" plane was replaced with the complex "z" plane, and the unit circle used instead of the j axis for the representation of frequency. Because zeros only are involved in FIR filter work, this provided a convenient gateway to getting started with z-plane ideas. In this Lab we will investigate more general DT filters that are characterized with both poles and zeros. These filters are known as recursive since they use feedback, and also as Infinite Impulse Response (IIR). With feedback we will be able to realize much higher selectivity than possible with a comparable complexity FIR implementation. The most conspicuous example is the second-order resonator, which will open the way to achieving realistic bandpass responses. As we proceed, we will find many parallels with the CT(continuous time) filter experiments in Lab 11. Part 1: we examine the behaviour of the basic second-order resonator implemented without zeros. Part 2: zeros are introduced to generate lowpass, bandpass, highpass and allpass responses using the Direct Form 2 structure. 15-2 © 2011 Emona Instruments Experiment 15 – Poles and Zeros in the z plane V1.2 Pre-requisite work: This preparation extends the theory covered in Lab 14 to include poles. INPUT x0 UNIT DELAY T u x1 UNIT DELAY T x2 -a1 -a2 Figure 1: schematic of 2nd-order feedback structure without feedforward. Question 1 Consider the feedback system in Figure 1. Show that the difference equation relating the adder output x0(nT) and the input u(nT) is x0(nT) = u[nT] - a1.x0[(n - 1)T] - a2.x0[(n - 2)T] (Eqn 1), where nT are the discrete time points, T sec denoting the unit delay, i.e. the time between samples. Show by substitution that ejnTw is a solution, i.e. show that when x0(nT) is of the form ejnTw, the input u(nT) is ejnTw, multiplied by a constant (complex-valued); w is the frequency of the input in radians/sec; (the use of complex exponentials for the representation of sinusoidal signals is discussed in Lab 8, 10 and 13. From the above, with input u(nT) = ejnTw obtain x0/u = 1/[ 1 + a1. e-jTw + a2. e-j2Tw] (Eqn 2). Note that x0/u is not a function of the time index n. Question 2 Use this result to obtain a general expression for |x0/u| as a function of w. Tip: to simplify the math, operate on u/x0 instead of x0/u, expressing the result in polar notation. Experiment 15 – Poles and Zeros in the z plane © 2011 Emona Instruments 15-3 Set T = 1 sec for the time being, and plot the result for the case a1 = -1.6 , a2 = 0.902 over the range w = 0 to π rad/sec. Label the frequency axis in Hz and in rad/sec. You should find there is a peak in the response near 0.09Hz. Graph 1:response plot Question 3 Replace "exp(jTw)" by the symbol "z" in Eqn 2. The result is H_x0(z) = x0/u = 1/(1 + a1.z-1 + a2.z-2 ) = z2 / ( z2 + a1.z + a2 ) (Eqn 3). The quadratic ( z2 + a1.z + a2 ) can be expressed in the factored form (z - p1)(z - p2). 15-4 © 2011 Emona Instruments Experiment 15 – Poles and Zeros in the z plane V1.2 Figure 2: Notes on the graphical interpretation of pole-zero plots Experiment 15 – Poles and Zeros in the z plane © 2011 Emona Instruments 15-5 Reviewing the finding of roots of the quadratic polynomial From equation 1 above x0(nT) = u[nT] - a1.x1(nT) - a2.x2(nT) substituting x1=x0.z-1 and x2=x0.z-1.z-1 we arrive at x0 = u –a1x0/z1 – a2x0/z2 Grouping x0 terms: x0(1 + a1/z1 + a2/z2) = u At this point we can see that although we started with negative gains in the circuit model, we now have positive values as coefficients in the quadratic equation. Further, we arrive at: x0/u = z2/(z2 + a1z1 + a2) which we earlier named Eqn 3. We now have the general quadratic form with positive coefficients. INSIGHT: positive coefficients result in negative gains in the actual implementation This quadratic (z2 + a1z + a2) can be expressed in factored form, as (z-p1)(z-p2) Remember that z, p1 & p2 are complex numbers. You can think of these as vectors: from the origin of the z plane to a 2 dimensional point on that plane. Each factor ie: (z-p1) and (z-p2) is a difference vector between a general point z, who’s locus we restrain to the unit circle, and the 2 specific roots p1 & p2. It will be a vector, having direction and magnitude, and can be expressed in polar notation as r⁄θ, or rejθ, or in Cartesian notation as (a + ib). Both these representation are complex numbers. If we define p1 as (σ + iw) and its conjugate, p2 as (σ – iw) we can express the quadratic factors as: (z- p1)(z- *p1) = z2 + p.*p – pz – *pz Switching to polar notation for convenience, p.*p = rejθ. re-jθ = r2 So that leaves z2 + r2 –z.(p + *p), and if using Cartesian notation in this instance for convenience, ie. p = σ + jw then p + *p = 2σ so z2 +(-2 σ)z + r2 = z2 -2 σ z + r2 = z2 +a1z + a2 Relating coefficients gives a1 = -2σ and a2 = r2 For stability the poles must always be inside the unit circle, hence 0 < a2 < 1 Changes in a1 directly influence the real component of the pole position a2 has a square law relationship with r of the pole. Other relationships, such as θ, w, imag part, can be derived from these easily with trigonometry. The general solution for the roots of the quadratic polynomial x2 + a1x + a2 is: x = -a1/2 +/- i√[a2-(a1/2)2] With these equations in mind consider how changes in the coefficients from the math will move the poles or zeros about the unit circle, and influence the response of the system. This lab aims to make you more familiar of the interrelationships between these parameters. 15-6 © 2011 Emona Instruments Experiment 15 – Poles and Zeros in the z plane V1.2 Using the values of a1 and a2 given in Question 2 above, find the roots p1 and p2 (express the result in polar notation). Mark the position of p1 and p2 on the complex z plane with an "x" to indicate that they represent poles. The distance between these points and the unit circle is of key importance. This is a parallel process to that in Lab 11 where we plotted zeros. A similar procedure was carried out in Lab 11 for a CT transfer function in the complex variable s. Write down a formula for p1 in terms of a1 and a2. Note that p1 may be real or complex depending on a1 and a2. Determine the conditions for p1 to be complex valued. For this case, express p1 in polar notation. Take note of the fact that |p1| does not depend on a1 (this will be useful later). Obtain p2 from p1. Question 4 Satisfy yourself that the magnitude response of H_x0 is given by |H_x0(w)| = 1/[|(ejTw - p1)|.|(expjTw - p2)|] (Eqn 4). This provides the key for the graphical method described in Lab 13 to obtain an estimate of the magnitude response. Again, we will use T = 1 . Plot the magnitude of the denominator for selected values of w over the range 0 to π. The quantity |(ejTw - p1)| becomes quite small and changes rapidly as the point on the unit circle is moved near p1. Plot additional points there as needed. Invert to get |H_x0(w)| and compare this with the result you obtained in (b). Experiment 15 – Poles and Zeros in the z plane © 2011 Emona Instruments 15-7 Graph 2:response plot b0 x0 b1 x1 x2 b2 1/Z y 1/Z u -a 1 -a2 Figure 3: block diagram of 2nd-order Direct-form 2 structure with feedforward. 15-8 © 2011 Emona Instruments Experiment 15 – Poles and Zeros in the z plane V1.2 Question 5 Modify Fig 1 by replacing the unit delays with a gain of 1/z and show that Eqn 3 follows by inspection using simple algebra. Question 6 Apply this idea to show that the transfer function for the system in Fig. 3 is H_y (z) = y/u = (b0 + b1.z-1 + b2.z-2 ) /(1 + a1.z-1 + a2.z-2 ) (Eqn5) Question 7 Use the graphical pole-zero method (covered in Experiment 14) to obtain estimates of the magnitude responses for the following cases (0 to Nyquist freq): (i) b0 =b2 = 1, b1 = 2, a1 and a2 as in Question 2. (ii) b0 = b2 = 1, b1 = - 2, a1 and a2 as in Question 2 (iii) b0 = 1, b1 = 0, b2 = - 1, a1 and a2 as in Question 2 Which of these is lowpass, highpass, bandpass? Experiment 15 – Poles and Zeros in the z plane © 2011 Emona Instruments 15-9 Graph 3:pole-zero method Question 8 Consider a DT system with sampling rate 20kHz. Obtain estimates of the poles and zeros that realize a lowpass filter with cut-off near 3kHz. Obtain a highpass filter using the same poles. Question 9 For the same sampling rate as in Question 8 obtain estimates of the poles and zeros that realize a bandpass filter centered near 3.1kHz, with 3dB bandwidth 500Hz. HINT: review Question 7 15-10 © 2011 Emona Instruments Experiment 15 – Poles and Zeros in the z plane V1.2 Equipment PC with LabVIEW Runtime Engine software appropriate for the version being used. NI ELVIS 2 or 2+ and USB cable to suit EMONA SIGEx Signal & Systems add-on board Assorted patch leads Two BNC – 2mm leads Procedure Part A – Setting up the NI ELVIS/SIGEx bundle 1. Turn off the NI ELVIS unit and its Prototyping Board switch. 2. Plug the SIGEx board into the NI ELVIS unit. Note: This may already have been done for you. 3. Connect the NI ELVIS to the PC using the USB cable. 4. Turn on the PC (if not on already) and wait for it to fully boot up (so that it’s ready to connect to external USB devices). 5. Turn on the NI ELVIS unit but not the Prototyping Board switch yet. You should observe the USB light turn on (top right corner of ELVIS unit).The PC may make a sound to indicate that the ELVIS unit has been detected if the speakers are activated. 6. Turn on the NI ELVIS Prototyping Board switch to power the SIGEx board. Check that all three power LEDs are on. If not call the instructor for assistance. 7. Launch the SIGEx Main VI. 8. When you’re asked to select a device number, enter the number that corresponds with the NI ELVIS that you’re using. 9. You’re now ready to work with the NI ELVIS/SIGEx bundle. 10. Select the EXPT 15 tab on the SIGEx SFP. Note: To stop the SIGEx VI when you’ve finished the experiment, it’s preferable to use the STOP button on the SIGEx SFP itself rather than the LabVIEW window STOP button at the top of the window. This will allow the program to conduct an orderly shutdown and close the various DAQmx channels it has opened. Ask the instructor to check your work before continuing. Experiment 15 – Poles and Zeros in the z plane © 2011 Emona Instruments 15-11 Experiment Part 1: IIR without feedforward: a second-order resonator In this part we implement and investigate the system in Fig 1. Figure 4: patching diagram for feedback structure without feedforward from Figure 1 11. Patch up a SIGEx model of the system in Fig 1. Settings are as follows: ADDER GAINS: a0=1; a1=+1.6; a2= -0.902 PULSE GENERATOR: 20kHz, DUTY CYCLE=0.5 (50%) FUNCTION GENERATOR: Sinewave selected, FREQUENCY=1k; Amplitude= 2V pp SCOPE: Timebase = 4ms, Trigger on input signal, Trigger level = 0V Question 10 Calculate the poles corresponding to these values. Measure and plot the magnitude response at the output of the feedback adder. Note and record the resonance frequency and the bandwidth. Use the poles to graphically predict these parameters; compare with your measurements. HINT: Do a quick sweep of frequency range, and turn AUTOSCALE off at maximum amplitude, then sweep the range more slowly while taking measurements. This will enable you to see the variation in gain of the output more easily than with AUTOSCALE on. Question 11 Decrease |a1| by a small amount ( around 5-10%, say) and measure the effect on the resonance frequency and bandwidth. Use this to estimate the migration of the poles. Does this agree with your expectations? Question 12 15-12 © 2011 Emona Instruments Experiment 15 – Poles and Zeros in the z plane V1.2 Repeat step 3 for a 5% decrease of a2. Compare the effects of varying a1 and a2. Which of these controls would you use to tune the resonance frequency? Use the formulas you obtained in the preparation to explain this. NOTE about TAB “ PZ plot” on the SIGEx SFP. This panel calculates the poles and zeros relating to the currently set ADDER gains which relate to the coefficients of the transfer function. Use this visualization tool to confirm your understanding . You may wish to move back and forth between the experiment TAB and the “PZ plot” TAB as required during the experiment. Figure 5: “PZ plot” TAB from SIGEx SFP You may wish to use the manual GAIN ADJUST knob on the SIGEx board to vary these parameters. Remember to setup its range to suit your parameter. Question 13 With a1 unchanged, gradually increase a2 and observe the narrowing of the resonance. Continue until you see indications of unstable behaviour. At that point, remove the input signal and observe the output (if needed, increase a2 a little more). Is it sinusoidal? Measure and record its frequency. Measure a2. Calculate and plot the pole positions. Note especially whether they are inside or outside the unit circle. Experiment 15 – Poles and Zeros in the z plane © 2011 Emona Instruments 15-13 Figure 6: patching diagram for step response 12. We will now repeat step 11 in the time domain. Use the PULSE GENERATOR as a clock source and SEQUENCE GENERATOR to set up a unit pulse input. The SYNC signal from the SEQUENCE GENERATOR will act as a repetitive unit pulse source. What matters is that the unit pulses are far enough apart that each pulse is a unique event to the system under investigation. Setting are as follows: PULSE GENERATOR: 20kHz, DUTY CYCLE=0.5 SEQUENCE GENERATOR: DIPS set to UP:UP (short sequence) ADDER gains: a0=1.0; a1=1.6; a2=-0.902; b0=1.0 Question 14 Begin with a2 around -0.9. Describe the effect on the response as the magnitude of a2 reduces. Measure the frequency of the oscillatory tail of the response and compare with your observations in step 5. Figure 7: typical pulse response 15-14 © 2011 Emona Instruments Experiment 15 – Poles and Zeros in the z plane V1.2 Graph 4:pole only response plot Figure 8: Setup with feedforward and feedback sections implemented, as per Figure 9 below Experiment 15 – Poles and Zeros in the z plane © 2011 Emona Instruments 15-15 Part 2 - IIR with feedforward: second-order filters In this part we implement and investigate the system in Fig 9. Note that the system with feedforward simply builds upon the previous system with feedback only. It also provides a new output point. The system response x0 for the feedback only, all-pole system is still available as a subset within this new arrangement and is unchanged by the additional feedforward elements. The feedforward elements simply add numerator terms to the overall transfer function which becomes y/u. b0 x0 b1 x1 x2 b2 1/Z y 1/Z u -a 1 -a2 Figure 9: block diagram of 2nd-order Direct-form 2 structure with feedforward. 13. Use ADDER B in a z-TRANSFORM module to convert the SIGEx model of Part 1 to the system in Fig 9. Figure 10: patching diagram for block diagram above 14. Implement case (i) in Prep (Q7). Settings are as follows: ADDER GAINS: b0=1; b1=2; b2=1; a0=1; a1=+1.6; a2= -0.902 PULSE GENERATOR: 20kHz, DUTY CYCLE=0.5 (50%) FUNCTION GENERATOR: Sinewave selected, FREQUENCY=1k; Amplitude= 1V pp 15-16 © 2011 Emona Instruments Experiment 15 – Poles and Zeros in the z plane V1.2 SCOPE: Timebase = 4ms, Trigger level = 0V, Trigger on input signal Figure 11: Using the Function Generator to sweep a sinusoid across the spectrum of interest. Observation: the high pass band gain due to the selection of coefficients resulting in poles very close to the unit circle, as shown in the figure below. Figure 12: details of the PZ PLOT TAB for the current settings (NB: 2 zeros at (-1 +/- 0i) are difficult to see in figure.) NOTE: The poles are very close to the unit circle. In fact, the pole radius is 0.95. Hence the gain close to the poles is very large. You can use the PZ PLOT to visualize the poles and zeros for any “live” coefficient settings. Zeros are also present at z = -1. Experiment 15 – Poles and Zeros in the z plane © 2011 Emona Instruments 15-17 Measure the magnitude response |y/u| and confirm that it is a lowpass filter. Graph 5: plot of responses Question 15 In the model of step 14, adjust a2 to reduce the peaking to a minimum. As well you will need to reduce the amplitude of the input signal to 0.5Vpp to reduce saturation. Confirm this for yourself. Plot the resulting response and measure the new value of a2. Calculate and plot the new poles. Obtain an estimate of the theoretical magnitude response with these poles and compare this with the measured curve. Why was a2 used for this rather than a1? Question 16 Change the polarity of b1 in the lowpass of step 19 and show that this produces a highpass. Compare with your findings in Question 7. 15-18 © 2011 Emona Instruments Experiment 15 – Poles and Zeros in the z plane V1.2 NOTE: the following three questions refer to the transfer function coefficient values. Remember to negate the a1 and a2 values when settings them up as ADDER GAINS. Question 17 Repeat for case (iii) in Question 7, that is: b0 = 1, b1 = 0; b2 = -1 ; a0 = 1; a1 =-1.6; a2 =0.902; Confirm this is a bandpass filter. Tune a1 and a2 to obtain a peak at 3.1 kHz and 3dB bandwidth 500Hz. Measure the resulting a1 and a2 and plot the new poles. Compare this with your findings in Question 7. Question 18 Implement the following case: a0 = 1, a1 = 0, a2 = 0.8, b0 = 0.8, b1 = 0, b2 = 1. Note that b0=a2 and b1=a1. Measure the magnitude response. Confirm it is allpass. Locate the positions of the poles and zeros. Plot them below for your records. Question 19 Change a1 and b1 to - 1.6 and confirm the response is still allpass. Examine the behaviour of the phase response. Look for the frequency of most rapid phase variation, and confirm this occurs near a pole. Plot the poles and zeros below for your records. Experiment 15 – Poles and Zeros in the z plane © 2011 Emona Instruments 15-19 Viewing spectrum of system with broadband noise input & FFT As well as sweeping a single frequency signal from the FUNCTION GENERATOR across the spectrum of interest it is also convenient to input a broad range of frequencies at once and view the overall output frequency response of the system. Creating a broadband analog noise signal was covered in Experiment 9. That methodology is shown in the figures below. You can revisit this experiment with this setup in place and see the relationships of poles and zeros to system response in real time. Figure 13: IIR filter with flat noise input Figure 14: experiment setup with noise input signal instead of Function Generator signal. Uses SEQUENCE GENERATOR and TUNEABLE LPF, clocked from PULSE GENERATOR. 15-20 © 2011 Emona Instruments Experiment 15 – Poles and Zeros in the z plane V1.2 15. Ensure that SEQUENCE GENERATOR DIP switches are set to positions DOWN:DOWN for the long sequence. Set TLPF knobs to fully clockwise for now. Switch to TAB “ZOOM FFT” to view time and frequency domains simultaneously. Change scope timebase to 100ms. Set up the coefficients as per step 14. Setting up the input noise signal: 16. i) Reduce the TLPF GAIN by rotating counter clockwise until the output Ch1 signal (red) is no longer saturated ie: less than 12V peak. ii) Reduce the noise bandwidth to around 4khz by rotating the TLPF block’s “Fc” control-counter clockwise. View the noise spectrum as the white trace on the SCOPE & FFT windows. The SFP should be similar to Figure 15 below for a peaky LPF as shown. Figure 15: ZOOM FFT TAB used to view Experiment 15 setup with flat noise input. Due to high gain, input noise level is very small. Note the limited bandwidth of the input noise to maintain a flat input response. (SEQUENCE GENERATOR must be set to long sequence.) At this point we can see and explore the issues relating to : -controlling our input signal level and bandwidth -viewing the response in both time and frequency domains -setting up a transfer function with appropriate internal gains We can also confirm that the peak of the response is correct according to the position of the poles. ie: PZ PLOT tells us that poles are at 32 degrees, hence we expect a peak close to 32/360*20,000 = 1777 Hz. You can use the cursors in ZOOM FFT window to confirm this. Experiment 15 – Poles and Zeros in the z plane © 2011 Emona Instruments 15-21 Question 20 Show your calculation of the where you expect the peak frequency to be using the pole position and sampling frequency. Dynamically varying the poles and zeros to adjust response using GAIN ADJUST manual control 17. Use the SIGEx board’s GAIN ADJUST knob to vary one of the coefficients by hand while viewing the frequency response. Leave the default settings. Turn the knob until it reads +1.6 (located in the COEFFICIENT SELECTOR window), then select radio button “ a1 ”. View the frequency response while slowly varying the value of a1. You will find that the peak frequency changes. 18. Find a range of a1 settings that work well and then view PZ PLOT while varying across that range. You will see the poles moving and reflecting the changing a1 coefficient. (Theory states that a1=-2σ, which is the real part of the pole and its conjugate.) Question 21 Confirm this relationship from values displayed on PZ PLOT and show your working here: 19. Set a1 back to +1.6, select OFF, then set GAIN ADJUST to -0.9, and select a2 radio button. For more resolution vary the setup parameters as required. Question 22 Varying a2 will vary the gain or peak level of the filter. Notice what happens in the time domain when a2 = -1.0. The filter breaks into oscillation. View the poles again using PZ PLOT while varying a2. (Theory states that a2 = r2). 20. Set a2 back to -0.9, then select OFF again at the COEFFICIENT SELECTOR to disable the GAIN ADJUST control. 15-22 © 2011 Emona Instruments Experiment 15 – Poles and Zeros in the z plane V1.2 Using Digital Filter Design toolkit to implement Highpass filters 21. Switch to the DFD TAB. This will allow you to automatically load the computed coefficients for the selected filter onto the SIGEx board. You can see the values on the TAB setup in the GAIN input controls on the SIGEx SFP. NOTE: Maintain the order of your filter structure <= 2, to match the structure you have built. 22. Connect CH0 to “ x0 ”, and CH1 to “Y” and view the internal signal levels at “x0” by switching to the ZOOM FFT tab. Set the TLPF GAIN higher but avoid saturating.These filters have lower internal gains than the previous ones. Vary the filter design type (at the DFD tab by clicking on “DESIGN METHOD” to select) and view the output responses using ZOOM FFT. NOTE: Press the button to transfer the coefficients into the ADDER gains when you are ready to do so. Set timebase to 100ms. Again you can use the cursors to compare the actual performance to theory and design. You can expect to see a display like so: Figure 16: Highpass filter response using FFT; x0 (grey); Y (white) Experiment 15 – Poles and Zeros in the z plane © 2011 Emona Instruments 15-23 Figure 17: DFD TAB used to design filters and setup coefficients to the patched SIGEx board Default values are chosen to enable students to see textbook like responses which they can easily measure. Question 23 Confirm that the SIGEx hardware performs as designed by theory in terms of notch positions etc. You will have to use the zero positions mostly in these cases. Why ? Notches are implemented by placement of zeros on or near the unit circle. Question 24 Try varying design values and take note of the ORDER of the filter designed. NOTE that the SIGEx experiment we have implemented can only support a 2nd order structure. Note your observations. 15-24 © 2011 Emona Instruments Experiment 15 – Poles and Zeros in the z plane V1.2 Tutorial Questions Q1. Why do the complex poles and zeros occur in conjugate pairs in the cases covered in this lab? Q2. Why is polar notation for complex valued poles and zeros preferred in the discrete-time context? Using examples from the lab, explain the importance of the position of complex poles/zeros relative to the unit circle when estimating frequency responses. Q3. Re Eqn 3, keeping a1 constant, plot the locus of the upper half plane pole with respect to a2. Do this for several suitable values of a1. Holding a2 constant, repeat this with respect to a1. Use the resulting contours to explain your observations in Q11 and Q12 . Q4. Determine the conditions on a1 and a2 for the poles to be complex. Display this graphically on a plane (i.e. with a2 = 0 as horizontal axis and a1=0 as vertical axis). Q5. Calculate and plot the poles and zeros in Q19. Satisfy yourself that they share the same radial line. Show that z1 = 1/p1* . Q6. Prove that the values of the coefficients in Q18 and Q19 generate a constant magnitude response over all frequencies. Write down the coefficient relationship in the transfer function of a fourth-order allpass. Q7. Consider the unit pulse response in Step 12. What is the effect on the decay rate as the bandwidth is decreased? Find a simple formula or rule of thumb to express this relationship. Q8. Show that the magnitude responses at nodes x1 and at x2 are the same as at x0 (can be demonstrated without math). Q9. Consider a bandpass filter realized with a2 = 0.98. What is the maximum deviation allowable in a2 to maintain a bandwidth tolerance of 5 percent? Q10. Consider the following assertion: "Continuous-time filters can be considered as a limiting case of discrete-time filters, as the sampling frequency to bandwidth ratio gets very large". Hint: show that the poles and zeros migrate to the area near (1,0) as the Nyquist ratio increases and compare the shapes of the unit circle and of the j axis in that region. Q11. Find out the meaning of the term "maximally flat". Is this description applicable to the filter produced in Q15 by reducing the value of a2? Experiment 15 – Poles and Zeros in the z plane © 2011 Emona Instruments 15-25 15-26 © 2011 Emona Instruments Experiment 15 – Poles and Zeros in the z plane V1.2 Experiment 16 – Discrete-time filters – practical applications Achievements in this experiment You will gain an understanding of the importance of sensitivity and dynamic range issues that arise in the practical implementation of discrete-time filters. As well you will explore the issues relating to optimum sampling rate selection. Preliminary discussion In the design of systems the primary focus initially is the signal at the output interface. However, at implementation, whether analog or digital, it is often discovered that the quality of the output may be adversely affected by problems at intermediate points. An important example is dynamic range at internal nodes. Unless properly managed, this can cause significant SNR degradation. In digital systems, the use of floating-point arithmetic is a solution in some instances. However in many applications, fixed-point implementation makes possible considerable cost savings. In this lab we will examine dynamic range performance in the filter structure used in Experiment 15, the "Direct Form 2" and compare this with an alternative, the "Transposed Direct Form 2". In many applications of digital signal processing, e.g., digital audio, there is a general perception that a high sampling rate is the key to superior performance, and that the motivation for moderation is to reduce demands on memory and processing load. This lab reveals another side of the coin, i.e., that an excessively generous sampling rate may unleash sensitivity challenges, and compromise performance. 16 2 © 2011 Emona Instruments Experiment 16 – Discrete time filters V1.2 Pre-requisite work Question 1 Using the method in Lab15 Question 5, show that the transfer function for the system in Fig.1 is H_y (z-1) = y/u = (b0 + b1.z-1 + b2.z-2 ) /(1 + a1.z-1 + a2.z-2 ) (Eqn1). u x b b1 2 2 1 x 1 x0 y -a 2 - a 1 Fig 1: block diagram of 2nd-order Transposed Direct-Form2 feedback structure Question 2 Consider a filter with a1 = -1.84 , a2 = 0.90 , b0 = 1 , b2 = b0 , b1 = -1.7. Calculate and plot the zeros of the transfer functions in (Q1). Question 3 From the results in (Q1) and (Q2) obtain the ratios x1/y and x2/y expressed as transfer functions in z. Use these to calculate |y/x2| and |y/x1| at the peak of the response of the filter in (Q2). Question 4 Consider the implementation of the filter in (Q2) using the Direct Form 2 structure in Lab 15 Fig 2. Satisfy yourself using only a quick inspection of the diagram, that with this structure the magnitude responses at the internal nodes are identical. Repeat (Q3) for this case, and compare the outcomes. This comparison will be applied in the Lab, hence it's important to have the analysis ready to use. Question 5 Consider a transfer function with the coefficients in Question 2 and sampling rate 10ksamples/sec. (a) Sketch the gain response versus frequency and note the peak and null frequencies. Repeat this with sampling rate 20ksamples/sec. Note that the general shape of the response is virtually unchanged, but the frequency axis has been rescaled. (b) The outcome in (a) is useful in some applications, however suppose we want to use the faster sampling rate without frequency axis rescaling. This will require relocating the poles and zeros so that their distance from the zero frequency point on the unit circle (1,0) is suitably reduced - by a factor of about 2, in this case. The pole should slide on a line joining (1,0) and its original position. The zero should remain on the unit circle. Use a computer to plot and compare the new and original responses. Suggest possible adjustments to the poles and zeros to reduce any differences. Experiment 16 – Discrete time filters © 2011 Emona Instruments 16-3 Question 6 Look up a suitable reference to confirm that the the bilinear transformations are as follows (T is the sampling interval): s = (2/T) .(z - 1)/(z + 1) z = (1 + (T/2)s )/(1 - (T/2)s ) These formulas are used to convert continuous time (CT) transfer functions to discrete time (DT), and vice versa. In this exercise we obtain the CT transfer function for the case in Question 2, and reverse the process with a new value of T to produce the DT transfer function for a higher sampling rate. (a) Find or write a program for implementing the bilinear transformations. (b) Use this to obtain the transfer function and the poles and zeros corresponding to the increased sampling rate in Question 5. Confirm that the zeros have remained on the unit circle (optional extra: prove theoretically that z plane unit circle zeros always transform to the j axis in the s plane, and vice versa). (c) Obtain a plot of the gain frequency response with the new sampling rate and compare this with the original and with the approximate case in Question xxx (b). (d) Compare the positions of the poles and zeros generated with the bilinear transformations versus the approximate case in Question xxx (b). Question 7 This question is about the effect of errors in coefficient values that may be encountered as a result of limited arithmetic word length. The errors proposed here are of the order that could occur with a 12-bit wordlength. (a) Consider the transfer function obtained in Q.6(c). Change the value of a2 by 0.1 percent. Plot the gain frequency response and compare with the original response. (b) Repeat (a) for coefficient a1, and then for both coefficients together (c) Examine the shift in the pole and zero positions for the coefficient errors in (a) and (b). Are these consistent with the gain response errors? (d) Plot the locus of the movement of a pole as a1 and a2 are varied, respectively. Point to aspects of these loci in the region near the point (1,0) that exacerbate the sensitivity issues relating to coefficient quantization. (e) Is there any significant advantage with floating point arithmetic compared with fixed point for the effects of coefficient quantization? 16 4 © 2011 Emona Instruments Experiment 16 – Discrete time filters V1.2 Equipment PC with LabVIEW Runtime Engine software appropriate for the version being used. NI ELVIS 2 or 2+ and USB cable to suit EMONA SIGEx Signal & Systems add-on board Assorted patch leads Two BNC – 2mm leads Procedure Part A – Setting up the NI ELVIS/SIGEx bundle 1. Turn off the NI ELVIS unit and its Prototyping Board switch. 2. Plug the SIGEx board into the NI ELVIS unit. Note: This may already have been done for you. 3. Connect the NI ELVIS to the PC using the USB cable. 4. Turn on the PC (if not on already) and wait for it to fully boot up (so that it’s ready to connect to external USB devices). 5. Turn on the NI ELVIS unit but not the Prototyping Board switch yet. You should observe the USB light turn on (top right corner of ELVIS unit).The PC may make a sound to indicate that the ELVIS unit has been detected if the speakers are activated. 6. Turn on the NI ELVIS Prototyping Board switch to power the SIGEx board. Check that all three power LEDs are on. If not call the instructor for assistance. 7. Launch the SIGEx Main VI. 8. When you’re asked to select a device number, enter the number that corresponds with the NI ELVIS that you’re using. 9. You’re now ready to work with the NI ELVIS/SIGEx bundle. 10. Select the Lab 16 tab on the SIGEx SFP. Note: To stop the SIGEx VI when you’ve finished the experiment, it’s preferable to use the STOP button on the SIGEx SFP itself rather than the LabVIEW window STOP button at the top of the window. This will allow the program to conduct an orderly shutdown and close the various DAQmx channels it has opened. Ask the instructor to check your work before continuing. Experiment 16 – Discrete time filters © 2011 Emona Instruments 16-5 Experiment Part 1 Dynamic range at internal nodes In this part we examine and compare magnitude responses at internal nodes for the DF2 (Direct Form 2) and the transposed DF2 structures. First, we review the behaviour of the DF2 structure used in Lab 15. We carry out all the measurements for this case first, before patching up the transposed structure. Direct Form 2 IIR 11. Patch up the SIGEx model of Lab 15 Part 2. Set the gains and polarity settings for the values given in Prep (Q2) above. Use an input signal amplitude of 400mv pp. This is quite small but necessary due to the large internal gains you will encounter. Use the sample rate from the PULSE GENERATOR set to 10kHz. NB: The values given in Q2 are transfer function coefficient values. Remember too negate the a1 & a2 values when setting up the ADDER gains. b0 x0 b1 x1 x2 b2 1/Z y 1/Z u -a 1 -a2 Figure 2: Direct Form 2 IIR structure (from Lab 15) 16 6 © 2011 Emona Instruments Experiment 16 – Discrete time filters V1.2 Figure 3: patching diagram for DF2 structure (from Lab 15) 12. Measure and plot the magnitude responses at the output y and also at the internal nodes x1, x2. Calculate and record the ratios |y/x2| and |y/x1| at the peaks of the responses. Ensure that you capture enough information to determine the 3dB bandwidth of the filter. REMINDER: To measure the 3dB bandwidth of the filter, find the difference between the upper -3dB frequency and the lower -3dB frequency. Graph 1: Magnitude responses Experiment 16 – Discrete time filters © 2011 Emona Instruments 16-7 Figure 4: coefficient to pole-zero plot for the DF2 structure 13. Enter your measurements into the following table. Table 1: Signal magnitudes for Direct form and Transposed Direct form IIR Direct Form 2 (for u = 400mv) Transposed Direct Form 2 ( for u = 400mv) Transposed Direct Form 2 ( for u = 1.6V) Peak (Hz) u (Vpp) y (Vpp) y/u gain x1 (Vpp) x2 (Vpp) Upper 3dB freq. Lower 3dB freq. BW 3dB 16 8 © 2011 Emona Instruments Experiment 16 – Discrete time filters V1.2 Question 8 What is the maximum level of internal gain you have measured in this filter ? Question 9 Why is it essential to keep the input signal at a low level ie: 400 mv pp ? Question 10 Keeping in mind that the SIGEx circuits maximum signal range is +/- 12V and the maximum gain of ADDER gain stages is +/- 2, what is the maximum level of observable signal you must keep within ? Experiment 16 – Discrete time filters © 2011 Emona Instruments 16-9 Transposed Direct Form 2 IIR 14. Patch up the SIGEx model of the Transposed DF2 system in Fig 5. Repeat the steps above and enter your measurements into the above table also. Plot the response on the graph as well. Reminder: the responses at x1 and x2 are not the same with this structure. This should be obvious from the block diagram of the structure. Use the two input levels as listed in the table to avoid overload. NOTE: The transposed form uses 3 adder junctions. What is available on the SIGEx board is a triple ADDER a, triple ADDER b, and dual ADDER f+g. These have been labeled to suit the nontransposed structure so some reorientation is needed when using these for transpose structures. The following figures show how to wire up the modules, as well as how to enter the coefficient values into the SFP. You are advised to closely follow the suggested wiring in order to get around the difficulty of the modified mapping for this structure. You may wish to confirm for yourself that the block diagram matches the patching diagram. u x b b1 2 2 1 x 1 x0 y -a 2 - a 1 Fig 5: block diagram of 2nd-order Transposed Direct-Form2 feedback structure Fig 6: patching diagram of 2nd-order Transposed Direct-Form2 feedback structure In Figure 6, the coefficient labels in the diagram do not correspond to those in the block diagram due to the varied connections needed. Follow the patching diagram and use the Table 2 below for guidance on entering the values correctly. 16 10 © 2011 Emona Instruments Experiment 16 – Discrete time filters V1.2 Table 2: Implementation table for mapping coefficients Theoretical value as per block diagram Implementation label as per patching diagram Implementation value F 1 (fixed) b0=1 G 1 (fixed) b1=-1.7 B2 -1.7 b2=1 A2 -1 a1=-1.84 B0 1.84 a2=0.9 A0 -0.9 A1 0 B1 1 Figure 7: Screenshot of correctly implemented coefficients for Transposed DF2 structure shown above 15. We now have two sets of ratios of the values of y/x2 and y/x1 at the peaks of the responses for each of the two structures. Confirm that with the transposed structure we can realize greater output voltages without causing saturation of the signals at nodes x2 and x1. Express the comparisons as ratios in dB units. Question 11 What is the difference in internal gain between the non-transposed and transposed structures (in dB) ? Tutorial Q 1 guides you through a theoretical interpretation of the results. Experiment 16 – Discrete time filters © 2011 Emona Instruments 16-11 Part 2 Implementations with high sampling ratio The higher the sampling rate, the greater the demands on the hardware, i.e. increased memory storage capacity and faster switching speeds. However, in some applications this may not represent a significant additional cost. Hence, if the opportunity is there, why not take advantage of it - after all, faster sampling will ease the demands on the complexity of antialiasing and analogue reconstruction filters. It turns out that there are some other issues that come into play, as the following exercise will reveal. For simplicity, reconstruct the DF2 filter from early in Part 1, as shown in Figure 3. This allows us to easily relate to the coefficients as entered in to the SIGEx SFP. Use the same coefficient values as per that part. Set the sampling clock rate to 10,000 Hz as per before. Use an input amplitude of 400 mv as before. 16. In the earlier part 1 of this lab you measured and noted the bandwidth of this filter structure. Quickly confirm your currently reconstructed filter matches the filter you built previously and confirm that its bandwidth is also the same. 17. Switch to the PZPLOT tab to view the pole and zero positions for this filter. Question 12 Document the transfer function and the poles and zeros for this original filter. Question 13 What do you expect will happen to the pole and zero positions for a sampling rate of 20,000 samples/sec ? Question 14 What do you expect this filter response to be like with a sampling clock rate of 20,000 samples/sec ? 18. Change the sampling rate at the PULSE GENERATOR to 20,000 Hz and review the filters response characteristic. Question 15 What are the -3dB points and bandwidth for this filter at 20,000 samples/sec ? 16 12 © 2011 Emona Instruments Experiment 16 – Discrete time filters V1.2 19. View the PZPLOT TAB again for this 20kHz filter and use your understanding of this plot to compute the frequency of the peak for this filter. As you would expect, the same poles and zero locations for a different sampling rate result in a filter with similar characteristics but which no longer meets the intended frequency specifications. The next part of this experiment is to consider how the same filter, with the same response as in Part 1, can be achieved at 20kHz. This will require poles and zeros to be moved towards the zero frequency point on the unit circle, i.e. the point (1,0). Question 16 Approximately how close to the origin will the poles and zeros need to be moved to ? 20. Apply your answer to the question above to determine the approximate position of the new poles and zeros, as well as the new coefficients. Implement this and measure the response to see how well it works. 21. Now in this step, using trial and error attempt to improve upon your previous attempt if you feel this is needed. Question 17 What was the best result you were able to achieve in this manner ? 22. A mathematical solution to this problem is the use of the Bilateral Transformation. The discrete filter design is transformed back to the continuous time domain representation as a prototype design, and then transformed back to the discrete domain at 20kHz. In this way the poles and zeros created are specifically for the filter required at the sampling rate specified. Question 18 What are the new poles and zeros using the bilateral transformation approach ? What is the new transfer function for this transformed filter ? NB: This was covered in the pre-lab preparatory questions. 23. Implement the coefficients from the new transfer function into the hardware via the SFP and measure the frequency response of the filter. How well does it match your design ? Experiment 16 – Discrete time filters © 2011 Emona Instruments 16-13 Sketch the response of the new filter below. Measure and note the 3 dB frequencies, and bandwidth. Graph 2: Response of new filter at 20kHz 16 14 © 2011 Emona Instruments Experiment 16 – Discrete time filters V1.2 Screenshot of 20ks/s filter response using PZPLOT TAB and noise input Question 19 What can you say about this new filter in terms of its sensitivity. What are positive and negatives of running this filter design at 20ksamples/sec ? If the poles and zeros are too close to the origin, then you encounter sensitivity issues, whereas if they are too distant from the frequency origin (1,0), ie: around 90 degrees, then you have a low number of samples per period of signal. Question 20 Can you suggest a range of angles, in which the poles and zeros would be optimally placed in order to avoid the challenges discovered above ? This may require experimentation or further reading. Experiment 16 – Discrete time filters © 2011 Emona Instruments 16-15 Tutorial Questions 16 16 Q1. Discuss possible advantages of the transposed DF2 structure in dealing with high sampling rate sensitivity issues. Q2. Look up the terms "decimation" and "interpolation" in the context of digital filters. How would these operations help to reduce the sensitivity problems investigated in Part 2 for filtering digital signals that have high ratios of Nyquist frequency to bandwidth? Q3. Consider the realization of a sixth order filter. One method is to use a cascade of three second order stages. An alternative is the use of a single stage DF2 or transposed DF2 realization. Discuss the factors that would determine your choice. Q4. Look up the poles and zeros for a sixth order elliptic filter (discrete-time or continuous-time). Suppose you decide to use a three-stage cascade implementation. There are many possibilities for the pairing of the poles and zeros. Show that there is an optimum pairing. Use an example to explain how it is done. Q5. Consider the transposed DF2 structure in the continuous-time context (Lab 11). Repeat the analysis of the internal nodes for that case and find the corresponding zeros. Carry out an analysis as in Q1 to see if the transposed structure is able to provide a dynamic range advantage in that application. © 2011 Emona Instruments Experiment 16 – Discrete time filters V1.2 Appendix A: SIGEx Lab to Textbook chapter table This table aims to direct users to sections of relevant texts which contain theory and exercises related to experiments currently documented and implemented with the SIGEx/NI ELVIS bundle. Given that SIGEx is by design an open-ended modeling system it is possible to build many more experiments than is currently documented. Users will find that many exercises from the texts which are currently undocumented in this Lab Manual can also be implemented directly with minimum extra documentation. Students can easily be directed to implement exercises from texts on the SIGEx board once they become familiar with the block diagram modeling approach to building experiments. The texts which are currently referred to in this Appendix are: Lathi.B.P. , “Signal processing & Linear Systems”, Oxford University Press Oppenheim.A.V.,Wilsky.A.S., “Signals & Systems”, Prentice Hall, 2nd edition Haykin, Van Veen, “Signals and Systems”, Wiley, 2nd edition Ziemer.R.E,Tranter.W.H, Fannin.D.R, “Signals & Systems: Continuous and Discrete”, Prentice Hall, 4th edition Boulet.B.: “Fundamentals of Signals & Systems”, Thomson/Delmar Learning McClellan.J.H, Schafer.R.W, Yoder.M.A, “DSP First”, Prentice Hall Lathi.B.P. , “Signal processing & Linear Systems”, Oxford University Press SIGEx Lab Manual Lathi: text book correlation S1-03: Special signals – characteristics and applications 1 Introduction to Signals and Systems B.2 Sinusoids 2.4 System response to external input: zero-state response S1-04: Systems: Linear and non-linear 1 Introduction to Signals and Systems S1-05: Unraveling convolution 9.4-1 Graphical procedure for the convolution sum S1-06: Integration, convolution, correlation & matched filters 2.4-1 The convolution integral 3.2 Signal comparison: Correlation S1-07: Exploring complex numbers and exponentials B.1 Complex numbers B.3-1 Monotonic exponentials B.3-2 The exponentially varying sinusoid S1-08: Build a Fourier series analyzer 3.4 Trigonometric fourier series S1-09: Spectrum analysis of various signal types 4 Continuous-time signal analysis: The fourier transform S1-10: Time domain analysis of an RC circuit 1.8 System model: Input-output description S1-11: Poles and zeros in the Laplace domain 6 Continuous-time system analysis using the Laplace transform S1-12: Sampling and Aliasing 5 Sampling 8.3 Sampling continuous-time sinusoid and aliasing S1-13: Getting started with analog-digital conversion 5.1-3 Applications of the sampling theorem (Pulse code modulation PCM) S1-14: Discrete-time filters with FIR systems 11 Discrete-time system analysis using the z-transform 12.1 Frequency response of discrete-time systems 12.2 Frequency response from pole-zero location 12 Frequency response and digital filters S1-15: Poles and zeros in the z plane with IIR systems S1-16: Discrete-time filters – issues in practical applications Not covered Oppenheim.A.V.,Wilsky.A.S., “Signals & Systems”, Prentice Hall, 2nd edition SIGEx Lab Manual Oppenheim, text book correlation S1-03: Special signals – characteristics and applications 1 Signals and Systems S1-04: Systems: Linear and non-linear 1 Signals and Systems 2 Linear time-invariant systems S1-05: Unraveling convolution 2.1 Discrete-time LTI systems: The convolution sum S1-06: Integration, convolution, correlation & matched filters 2.2 Continuous-time LTI systems: The convolution integral 2 Linear time-invariant systems; Problem 2.67 S1-07: Exploring complex numbers and exponentials 1 Signal and systems: Mathematical review 1.3 Exponentials and sinusoidal signals S1-08: Build a Fourier series analyzer 3.3 Fourier series representation of continuous-time periodic signals S1-09: Spectrum analysis of various signal types 4.1.3 Examples of Continuous-Time Fourier transforms S1-10: Time domain analysis of an RC circuit 3.10.1 A simple RC lowpass filter 3.10.2 A simple RC highpass filter S1-11: Poles and zeros in the Laplace domain 9 The Laplace transform 9.4 Geometric evaluation of the Fourier transform from the pole-zero plot S1-12: Sampling and Aliasing 7 Sampling S1-13: Getting started with analog-digital conversion 8.6.3 Digital Pulse-Amplitude (PAM) and Pulse-Code modulation (PCM) S1-14: Discrete-time filters with FIR systems 6.6 First-order and second-order discrete time systems 6.7.2 Examples of discrete-time nonrecursive filters S1-15: Poles and zeros in the z plane with IIR systems 10.4 Geometric evaluation of the Fourier transform from the pole-zero plot S1-16: Discrete-time filters – issues in practical applications Not covered Haykin, Van Veen, “Signals and Systems”, Wiley, 2nd edition SIGEx Lab Manual Haykin, Van Veen, text book correlation S1-03: Special signals – characteristics and applications 1.6 Elementary signals S1-04: Systems: Linear and non-linear 1.8 Properties of systems S1-05: Unraveling convolution 2.2 The convolution sum S1-06: Integration, convolution, correlation & matched filters 2.5 Convolution integral evaluation procedure S1-07: Exploring complex numbers and exponentials 1.6.3 Relation between sinusoidal and complex exponential signals A.2 Complex numbers S1-08: Build a Fourier series analyzer 3.5 Continuous-time periodic signals: The Fourier series S1-09: Spectrum analysis of various signal types 4.2 Fourier Transform representations of Periodic signals S1-10: Time domain analysis of an RC circuit 6.7 Laplace transform methods in circuit analysis S1-11: Poles and zeros in the Laplace domain 6 Representing signals by using continuous-time complex exponentials: the Laplace transform 6.13 Determining the Frequency response from poles & zeros S1-12: Sampling and Aliasing 4.5 Sampling 4.6 Reconstruction of continuous-time signals from samples S1-13: Getting started with analog-digital conversion 4.6.3 A practical reconstruction: the zero order hold 5.2 Types of modulation (PCM) S1-14: Discrete-time filters with FIR systems 7 Representing signals by using continuous-time complex exponentials: the z- transform 8.9 Digital FIR filters 7.8 Determining the Frequency response from poles & zeros 8.10 IIR Digital filters S1-15: Poles and zeros in the z plane with IIR systems S1-16: Discrete-time filters – issues in practical applications 7.9 Computational structures for implementing discretetime LTI systems Ziemer.R.E,Tranter.W.H, Fannin.D.R, “Signals & Systems : Continuous and Discrete”, Prentice Hall, 4th edition SIGEx Lab Manual Ziemer, Tranter, Fannin, text book correlation S1-03: Special signals – characteristics and applications 1-3 Signal models S1-04: Systems: Linear and non-linear 2-2 Properties of systems S1-05: Unraveling convolution 8-4 Difference equations and discrete-time systems; Example 8-12 Discrete convolution 10-6 Convolution 10-6 Energy spectral density and autocorrelation function S1-06: Integration, convolution, correlation & matched filters S1-07: Exploring complex numbers and exponentials 1-3 Phasor signals and spectra S1-08: Build a Fourier series analyzer 3-3 Obtaining trigonometric Fourier series representations for periodic signals 3-4 The complex exponential Fourier series 4.5 Fourier transform theorems S1-09: Spectrum analysis of various signal types S1-10: Time domain analysis of an RC circuit 2-2:2-7 System modeling concepts 6-2 Network analysis using the Laplace transform S1-11: Poles and zeros in the Laplace domain 6-4 Transfer functions S1-12: Sampling and Aliasing 8-2 Sampling 8-2 Impulse-train sampling model S1-13: Getting started with analog-digital conversion 8-2 Quantizing and encoding S1-14: Discrete-time filters with FIR systems 9-5 Design of finite-duration impulse response (FIR) digital filters S1-15: Poles and zeros in the z plane with IIR systems 9-4 Infinite Impulse Response (IIR) filter design S1-16: Discrete-time filters – issues in practical applications 9-2 Structures of digital processors Boulet.B.: “Fundamentals of Signals & Systems”, Thomson/Delmar Learning SIGEx Lab Manual Boulet, text book correlation S1-03: Special signals – characteristics and applications 1 Elementary continuous-time and discrete-time signals and systems S1-04: Systems: Linear and non-linear 2 Linear Time-invariant systems S1-05: Unraveling convolution 2 Discrete-time systems: The convolution sum S1-06: Integration, convolution, correlation & matched filters 2 The convolution integral S1-07: Exploring complex numbers and exponentials 1 Complex exponential signals S1-08: Build a Fourier series analyzer 4 Determination of the Fourier series representation of a continuous-time periodic signal S1-09: Spectrum analysis of various signal types 4 Fourier series representation of periodic continuous-time signals S1-10: Time domain analysis of an RC circuit 9 Application of Laplace transform techniques to electric circuit analysis S1-11: Poles and zeros in the Laplace domain 6 Poles and zeros of rational Laplace transforms S1-12: Sampling and Aliasing 15 Sampling systems S1-13: Getting started with analog-digital conversion 16 Modulation of a pulse-train carrier 15 Signal reconstruction S1-14: Discrete-time filters with FIR systems 14 Geometric evaluation of the DTFT from the pole-zero plot S1-15: Poles and zeros in the z plane with IIR systems 14 Infinite Impulse Response and Finite Impulse Response filters S1-16: Discrete-time filters – issues in practical applications Not covered McClellan.J.H, Schafer.R.W, Yoder.M.A, “DSP First”, Prentice Hall SIGEx Lab Manual “DSP First”, text book correlation S1-03: Special signals – characteristics and applications 1 Mathematical representation of signals S1-04: Systems: Linear and non-linear 2 Thinking about systems S1-05: Unraveling convolution 5.3.3 Convolution and FIR filters S1-06: Integration, convolution, correlation & matched filters Not covered S1-07: Exploring complex numbers and exponentials 2.5 Complex exponentials and phasors S1-08: Build a Fourier series analyzer 3.4.1 Fourier series analysis S1-09: Spectrum analysis of various signal types 3 Spectrum representation S1-10: Time domain analysis of an RC circuit Not covered S1-11: Poles and zeros in the Laplace domain Not covered S1-12: Sampling and Aliasing 4 Sampling and aliasing S1-13: Getting started with analog-digital conversion 4.4 Discrete to continuous conversion S1-14: Discrete-time filters with FIR systems 5 FIR filters S1-15: Poles and zeros in the z plane with IIR systems 8 IIR filters S1-16: Discrete-time filters – issues in practical applications 8 IIR filters Appendix B: Quickstart guide to using SIGEx Using “Experiment 15–Poles and zeros in the z-plane” as a basis for a demonstration of SIGEx Achievements in this experiment Students learn better when they can see the theory in action with real systems. You will be able to visualize the effect of pole zero placement on the system response for the time and frequency domain. You can confirm the theory and compare with real system performance. You can vary parameters in real time and confirm your understanding. You will be able to develop knowledge to intuitively design transfer function responses. Firstly browse through the sample manual to see the breadth and depth of possible hands-on laboratory work possible with the NI ELVIS/SIGEx bundle. Equipment PC with LabVIEW Runtime Engine software appropriate for the version being used. NI ELVIS 2 or 2+ and USB cable to suit EMONA SIGEx Signal & Systems add-on board Assorted patch leads Two BNC – 2mm leads Follow setup Procedure as listed on page 11 of Experiment 15 to run the SIGEx board. Reproduced here: Procedure Part A – Setting up the NI ELVIS/SIGEx bundle 1. Turn off the NI ELVIS unit and its Prototyping Board switch. 2. Plug the SIGEx board into the NI ELVIS unit. Note: This may already have been done for you. 3. Connect the NI ELVIS to the PC using the USB cable. 4. Turn on the PC (if not on already) and wait for it to fully boot up (so that it’s ready to connect to external USB devices). 5. Turn on the NI ELVIS unit but not the Prototyping Board switch yet. You should observe the USB light turn on (top right corner of ELVIS unit).The PC may make a sound to indicate that the ELVIS unit has been detected if the speakers are activated. 6. Turn on the NI ELVIS Prototyping Board switch to power the SIGEx board. Check that all three power LEDs are on. 7. Launch the SIGEx Main VI. 8. When you’re asked to select a device number, enter the number that corresponds with the NI ELVIS that you’re using. You’re now ready to work with the NI ELVIS/SIGEx bundle. 9. Select the EXPT 15 tab on the SIGEx SFP. Note: To stop the SIGEx VI when you’ve finished the experiment, it’s preferable to use the STOP button on the SIGEx SFP itself rather than the LabVIEW window STOP button at the top of the window. This will allow the program to conduct an orderly shutdown and close the various DAQmx channels it has opened. Part B – Setting up the experiment Run “NI ELVISmx Instrument Launcher” and select the FGEN “ Function Generator”. Run it and minimise the FGEN panel for now. Viewing SIGEx SFP, select Lab 15, which relates to laboratory Experiment 15. Patch together the experiment from “Part 2-IIR with feedforward : second order filters” on page 16 using Figure 1 . You will be building a 2nd order IIR filter and reviewing its response by sweeping it with a single frequency sinusoid from the FGEN across its range. Figure 1: IIR filter with sinusoidal input Settings are as listed in step 19. Reproduced here: ADDER GAINS: b0=1; b1=2; b2=1; a0=1; a1=+1.6; a2= -0.902 PULSE GENERATOR: 20kHz, DUTY CYCLE=0.5 (50%) FUNCTION GENERATOR: Sinewave selected, FREQUENCY=1k; Amplitude= 1V pp SCOPE: Timebase = 4ms, Trigger level = 0V, Trigger on input signal Note that you are entering into the SIGEx SFP the coefficient values for the transfer function which are immediately setup in the hardware experiment structure you have patched up. Connect CH0 scope lead to the S/H analog input terminal, and CH1 scope lead to the output of the B TRIPLE ADDER, which is the output of the IIR filter. (Remember to also connect the scope’s black leads to GND terminals.) Select “Y AUTOSCALE” OFF using the convenient toggle switch above the tabs. At times you may need to turn the Y autoscale ON again to adjust to current signals levels. Sweep the FGEN frequency from about 500Hz to 7kHz and observe the LPF effect you have implemented. Note that just before the rolloff that the high q of the filter causes the output to saturate. This is entirely due to the coefficient values selected and is discussed in the experiment preparation. To see the poles and zeros of the transfer function you have implemented, switch to TAB “PZ PLOT”. This TAB will display the poles and zeros for the coefficients currently setup on the SIGEx SFP. You can see that the poles are very close to the unit circle (r=0.95), hence the high gain at the peak before rolloff. Figure 1: IIR filter with broad spectrum noise input Viewing the system response using FFT To view the response more dynamically, you will now change your input signal. Change the patching of the FUNCTION GENERATOR to match Figure 2. You will now be inputting a flat noise spectrum and viewing the FFT of the filtered output of the system. Figure 2: IIR filter with flat broadband noise input Ensure that SEQUENCE GENERATOR DIP switches are set to positions DOWN:DOWN. Set TLPF knobs to fully clockwise for now. Switch to TAB “ZOOM FFT” to view time and frequency domains simultaneously. Change scope timebase to 100ms. Setting up the input noise signal: i) Reduce the TLPF GAIN by rotating counter clockwise until the output Ch1 signal (red) is no longer saturated ie: less than 12V peak. A maximum level of 6 V is optimum to avoid saturation of internal ADDER nodes. ii) Reduce the noise bandwidth to around 4khz by rotating the TLPF block’s “Fc” control-counter clockwise. View the noise spectrum as the white trace on the SCOPE & FFT windows. The SFP should be similar to Figure 3 below: Figure 3: IIR filter response using FFT; note the very small input signal (white) At this point we can see and explore the issues relating to : -controlling our input signal level and bandwidth -viewing the response in both time and frequency domains -setting up a transfer function with appropriate internal gains We can also confirm that the peak of the response is correct according to the position of the poles. ie: PZ PLOT tells us that poles are at 32 degrees, hence we expect a peak close to 32/360*20,000 = 1777 Hz. You can use the cursors in ZOOM FFT window to confirm this. Dynamically varying the poles and zeros to adjust response using GAIN ADJUST manual control Use the SIGEx board’s GAIN ADJUST knob to vary one of the coefficients by hand while viewing the frequency response. Leave the default settings. Turn the knob until it reads +1.6 (located in the COEFFICIENT SELECTOR window), then select radio button “ a 1 ”. View the frequency response while slowly varying the value of a1. You will find that the peak frequency changes. Find a range of a1 settings that work well and then view PZ PLOT while varying across that range. You will see the poles moving and reflecting the changing a 1 coefficient. (Theory states that a1=-2σ, which is the real part of the pole and its conjugate.) You can confirm this relationship from values displayed on PZ PLOT. Set a1 back to +1.6, select OFF, then set GAIN ADJUST to -0.9, and select a 2 radio button. Varying a2 will vary the gain or peak level of the filter. Notice what happens in the time domain when a2 = -1.0. The filter breaks into oscillation. View the poles again using PZ PLOT while varying a2. (Theory states that a2 = r 2). Set a2 back to -0.9, then select OFF again at the COEFFICIENT SELECTOR to disable the GAIN ADJUST control. Using Digital Filter Design toolkit to implement Highpass filters Switch to the DFD TAB. This will automatically load the computed coefficients for the selected filter onto the SIGEx board. You can see the values on the TAB setup in the GAIN input controls on the SIGEx SFP. Connect CH0 to “ x0 ”, and CH1 to “Y” and view the internal signal levels at “x0” by switching to the ZOOM FFT tab. Set the TLPF GAIN higher but avoid saturating.These filters have lower internal gains than the previous ones. Vary the filter design type (at the DFD tab by clicking on “DESIGN METHOD” to select) and view the output responses using ZOOM FFT. Set timebase to 100ms. Again you can use the cursors to compare the actual performance to theory and design. You can expect to see a display like so: Figure 4: Highpass filter response using FFT; x0 (white); Y (red) Figure 5: DFD tab used to design filters and setup coefficients to the patched SIGEx board Default values are chosen to enable students to see textbook like responses which they can easily measure. Conclusion This quickstart guide is designed to demonstrate quickly, and without supporting preparation, some of the powerful interactivity of the SIGEx board. Students can expect to gradually build up to this level of complexity with the many documented earlier experiments from the SIGEx Lab Manual. By building and controlling experiments using real circuits, students will develop confidence and intuitive familiarity with the theory they have covered in class. References Lathi.B.P. , “Signal processing & Linear Systems”, Oxford University Press Oppenheim.A.V.,Wilsky.A.S., “Signals & Systems”, Prentice Hall, 2nd edition Haykin, Van Veen, “Signals and Systems”, Wiley, 2nd edition Ziemer.R.E,Tranter.W.H, Fannin.D.R, “Signals & Systems: Continuous and Discrete”, Prentice Hall, 4th edition Boulet.B.: “Fundamentals of Signals & Systems”, Thomson/Delmar Learning Frederick.D.K.,Carlson.A.B.: “Linear systems in communication and control”, Wiley Carlson.A.B.: “Communication systems”, McGraw Hill, 2nd edition Smith.C.E.: “Applied mathematics for radio and communication engineers”, Dover Lynn.P.A., “An introduction to the analysis and processing of signals”, Macmillan Maor.E.,”e: The story of a number”, Princeton University Press Radzyner.R / Rakus.M: “Signals and systems experiments with Emona TIMS”, Emona Instruments, Issue 3.0 Langton, C.: “Fourier analysis made easy”, www.complextoreal.com McClellan.J.H, Schafer.R.W, Yoder.M.A, “DSP First”, Prentice Hall Emona SIGEx™ Lab Manual Signals & Systems Experiments with the Emona SIGEx Volume 1 Emona Instruments Pty Ltd 78 Parramatta Road Camperdown NSW 2050 AUSTRALIA web: www.emona-tims.com telephone: +61-2-9519-3933 fax: +61-2-9550-1378 The "SIGEx" logo is a trademark of Emona TIMS PTY LTD