Introduction to Simulink

Similar documents
ENSC327 Communication Systems Fall 2011 Assignment #1 Due Wednesday, Sept. 28, 4:00 pm

Introduction to Simulink Assignment Companion Document

Memorial University of Newfoundland Faculty of Engineering and Applied Science. Lab Manual

Experiment 1 Introduction to Simulink

Experiment 1 Introduction to MATLAB and Simulink

Experiment 2 Effects of Filtering

Introduction to Modeling of Switched Mode Power Converters Using MATLAB and Simulink

EE25266 ASIC/FPGA Chip Design. Designing a FIR Filter, FPGA in the Loop, Ethernet

COMMUNICATION LABORATORY

Use of the LTI Viewer and MUX Block in Simulink

Lab 1B LabVIEW Filter Signal

ECEGR Lab #8: Introduction to Simulink

Laboratory Experiment #1 Introduction to Spectral Analysis

Contents. Introduction 1 1 Suggested Reading 2 2 Equipment and Software Tools 2 3 Experiment 2

EEL 4350 Principles of Communication Project 2 Due Tuesday, February 10 at the Beginning of Class

EXPERIMENT 4 INTRODUCTION TO AMPLITUDE MODULATION SUBMITTED BY

Experiment 4 Sampling and Aliasing

Lab 1: First Order CT Systems, Blockdiagrams, Introduction

PHYC 500: Introduction to LabView. Exercise 9 (v 1.1) Spectral content of waveforms. M.P. Hasselbeck, University of New Mexico

DIGITAL SIGNAL PROCESSING TOOLS VERSION 4.0

LabVIEW Basics Peter Avitabile,Jeffrey Hodgkins Mechanical Engineering Department University of Massachusetts Lowell

Advanced Lab LAB 6: Signal Acquisition & Spectrum Analysis Using VirtualBench DSA Equipment: Objectives:

Page 1/10 Digilent Analog Discovery (DAD) Tutorial 6-Aug-15. Figure 2: DAD pin configuration

DSP Laboratory (EELE 4110) Lab#10 Finite Impulse Response (FIR) Filters

Lab 1: Simulating Control Systems with Simulink and MATLAB

SigCal32 User s Guide Version 3.0

C.8 Comb filters 462 APPENDIX C. LABORATORY EXERCISES

RF Blockset For Use with Simulink

Getting Started. Before You Begin, make sure you customized the following settings:

Figure C-1 (p. 907) MATLAB window showing how to access Simulink. The Simulink Library Browser button is shown circled.

Exploring DSP Performance

IJSRD - International Journal for Scientific Research & Development Vol. 5, Issue 06, 2017 ISSN (online):

Excel Tool: Plots of Data Sets

ME scope Application Note 01 The FFT, Leakage, and Windowing

Lab 12 Laboratory 12 Data Acquisition Required Special Equipment: 12.1 Objectives 12.2 Introduction 12.3 A/D basics

ES442 Final Project AM & FM De/Modulation Using SIMULINK

ECE411 - Laboratory Exercise #1

SolidWorks Tutorial 1. Axis

Lab 8. Signal Analysis Using Matlab Simulink

Experiment 6: Multirate Signal Processing

ME scope Application Note 02 Waveform Integration & Differentiation

EE354 Spring 2016 Lab 1: Introduction to Lab Equipment

Implementation of QAM Modulation Demodulation Based on. Simulink

1. Start with scatter plot: 2. Find corner points. 3. Capture image. 4. Corners

The operation manual of spotlight 300 IR microscope

Design and Implementation of Software Defined Radio Using Xilinx System Generator

1 PeZ: Introduction. 1.1 Controls for PeZ using pezdemo. Lab 15b: FIR Filter Design and PeZ: The z, n, and O! Domains

The Design and Simulation of Embedded FIR Filter based on FPGA and DSP Builder

Spectrum Analyzer TEN MINUTE TUTORIAL

LAB #7: Digital Signal Processing

Magnitude and Phase Measurements. Analog Discovery

Engineering 3821 Fall Pspice TUTORIAL 1. Prepared by: J. Tobin (Class of 2005) B. Jeyasurya E. Gill

Lab 3: Introduction to Software Defined Radio and GNU Radio

The Revolve Feature and Assembly Modeling

DS-2000 Series Measurement of Frequency Response Function

PSPICE T UTORIAL P ART I: INTRODUCTION AND DC ANALYSIS. for the Orcad PSpice Release 9.2 Lite Edition

Frequency Domain Representation of Signals

Excel Lab 2: Plots of Data Sets

Digital Filter Designer

Image Processing Tutorial Basic Concepts

GEORGIA INSTITUTE OF TECHNOLOGY. SCHOOL of ELECTRICAL and COMPUTER ENGINEERING. ECE 2026 Summer 2018 Lab #8: Filter Design of FIR Filters

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

Practical Assignment 1: Arduino interface with Simulink

Experiment 8: An AC Circuit

Alibre Design Tutorial: Loft, Extrude, & Revolve Cut Loft-Tube-1

Session 3: Getting to Know Photoshop Elements. Keep in mind that there are many others ways of solving the problems.

(i) Understanding of the characteristics of linear-phase finite impulse response (FIR) filters

Lab 4 An FPGA Based Digital System Design ReadMeFirst

Reading: Johnson Ch , Ch.5.5 (today); Liljencrants & Lindblom; Stevens (Tues) reminder: no class on Thursday.

E x p e r i m e n t 2 S i m u l a t i o n a n d R e a l - t i m e I m p l e m e n t a t i o n o f a S w i t c h - m o d e D C C o n v e r t e r

Pull Down Menu View Toolbar Design Toolbar

TSKS01 Digital Communication

1. Creating geometry based on sketches 2. Using sketch lines as reference 3. Using sketches to drive changes in geometry

EE 3302 LAB 1 EQIUPMENT ORIENTATION

Creo Revolve Tutorial

(i) Understanding of the characteristics of linear-phase finite impulse response (FIR) filters

Volume. AnCAD INCORPORATED Simply Faster. Visual Signal DAQ Express User Guide

Laboratory Assignment 1 Sampling Phenomena

Welcome to SPDL/ PRL s Solid Edge Tutorial.

Drawing Bode Plots (The Last Bode Plot You Will Ever Make) Charles Nippert

MultiSim and Analog Discovery 2 Manual

ASN Filter Designer Professional/Lite Getting Started Guide

Lab 3 Introduction to SolidWorks I Silas Bernardoni 10/9/2008

P a g e 1 ST985. TDR Cable Analyzer Instruction Manual. Analog Arts Inc.

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

Time-Varying Signals

Assignment 12 CAD Mechanical Part 2

SigCalRP User s Guide

Signal Processing Toolbox

Sante FFT Imaging Copyright 2018 Santesoft, all rights reserved

1. Create a 2D sketch 2. Create geometry in a sketch 3. Use constraints to position geometry 4. Use dimensions to set the size of geometry

Input of Precise Geometric Data

Ansoft Designer Tutorial ECE 584 October, 2004

Instruction Manual for Concept Simulators. Signals and Systems. M. J. Roberts

Tutorial 2: Setting up the Drawing Environment

Laboratory Assignment 5 Amplitude Modulation

ECE4902 Lab 5 Simulation. Simulation. Export data for use in other software tools (e.g. MATLAB or excel) to compare measured data with simulation

Kitchen and Bath Design Tutorial

SpinCore RadioProcessor LabVIEW Extensions

ILLUSTRATOR BASICS FOR SCULPTURE STUDENTS. Vector Drawing for Planning, Patterns, CNC Milling, Laser Cutting, etc.

Transcription:

EE 460 Introduction to Communication Systems MATLAB Tutorial #3 Introduction to Simulink This tutorial provides an overview of Simulink. It also describes the use of the FFT Scope and the filter design blocks. In addition to requiring MATLAB/Simulink, you will also need the DSP Toolbox for this tutorial. Introduction to Simulink Simulink is a companion program to MATLAB and is included with the student version. It is an interactive system for simulating linear and nonlinear dynamic systems. It is a graphical mousedriven program that allows you to model a system by drawing a block diagram on the screen and manipulating it dynamically. It can work with linear, nonlinear, continuous time, discrete time, multivariable, and multirate systems. Getting Started with Simulink In this section we will illustrate a very simple use of Simulink to display a sine wave in the time domain. 1. Open MATLAB and in the command window, type: simulink at the prompt. Alternatively, there is a Simulink icon in the menu bar. 2. After a few seconds Simulink will open and the Simulink Library Browser will open as shown in figure 1. It is important to note that the list of libraries may be different on your computer. The libraries are a function of the toolboxes that you have installed. At a minimum you should have the Simulink and DSP Toolbox libraries on your list.

Figure 1. Simulink Library Browser 3. Click on the New Model icon in the Library Browser window. An additional window will open. This is where you will build your Simulink models. 4. Click on the arrow next to DSP System Toolbox in the Library Browser. A list of sublibraries will appear including Estimation, Filtering, etc.

5. Click once on the Sources sub-library. You should see a listing of blocks as shown in the right column of figure 2. Note that there is another sources sub-library under Simulink but we want to use one of the DSP sources in this example. Figure 2. Source Blocks in the Simulink Library 6. Scroll down this list until you see the Sine Wave icon. Click once on the icon to select it and drag this icon into the blank model window.

7. Double click on the Sine Wave block and the parameters window shown in figure 3 will appear. Among the default parameters the sine wave frequency is set to 100Hz and the sample time to 1/1000 seconds or 1 ms. A 100Hz sine wave has a period of 10 ms. Thus, the generated signal will contain 10 samples per cycle of the sine wave. Figure 3. Sine Wave Source Block Parameter Window

8. Click once on the Sinks sub-library that is listed under Simulink in the Library Browser. Click and drag the Scope icon to the model window to the right of the Sine Wave block. The model window should now appear as shown in figure 4. Make sure you have used Scope, not Floating Scope. Figure 4. Model Window with Sine Wave and Scope Blocks 9. Next we want to connect the Sine Wave to the Scope block. Move the mouse over the output terminal of the Sine Wave block until it becomes a crosshair. Click and drag the wire to the input terminal of the Scope block. The cursor will become a double cursor when it is in the correct position. Release the mouse button and the wire will snap into place. Your completed system should now appear as shown in figure 5. Figure 5. Completed System for Viewing Sine Wave

10. In the model window select Simulation Configuration Parameters. Since the period of a cycle is 10ms, if we want to view 5 cycles we need to simulate for 50ms or 0.05 seconds. Enter 0.05 in the Stop time and click OK. Select Simulation Start. You will hear a beep when the simulation is complete. Double click on the Scope icon and it will open and display the output of the sine wave block. Try clicking on the Autoscale icon in the Scope window. This should cause the axes to readjust as shown in figure 6 Figure 6. Scope Display 11. Reopen the Sine Wave parameters window and change the Sample Time to 1/10000 and rerun the simulation. Now there are 100 samples per cycle and the curve is smoother. Note that the Nyquist criterion only requires a sampling frequency over 200 samples/second for this 100 Hz sine wave. However, a higher sampling frequency provides a smoother curve in the time domain. 12. Note that each time you simulate this model a warning appears in the Command Window. Open the Configuration Parameters window and change the Solver to Discrete. The warning will no longer appear.

Viewing the Spectrum of a Signal in Simulink 1. Return to the Library Browser and open Sinks sub-library in the DSP System Toolbox. Add the spectrum scope block to the model window and connect it to the output of the Sine wave as shown below. Figure 7. Power Spectral Density Sink 2. Double click on the Spectrum Scope block. This block calculates and displays the FFT of the incoming signal. As discussed in Tutorial 2, the display will depend on the sample time, T s, and the number of points in the FFT, N. Be sure that you have reviewed Tutorial 2 so that you are familiar with how these values affect the display. Set the options in this block as follows: Spectrum Units: Watts This sets the units of the y-axis. Spectrum Type: One-sided Since the amplitude spectrum is even we have all the information in a one sided spectrum. Buffer input: checked Buffer size: 128 This will determine the length of the FFT, N. Buffer overlap: 0 Window: Boxcar Specify FFT Length: unchecked This will cause the buffer size above to set N. Number of Spectral averages: 2 Recall that the sample time was set by the sine wave block to be 1/10000 or.1 ms. Thus, the sampling frequency is 10,000 and the maximum frequency produced by the FFT is 5000Hz.

The Spectrum Scope needs to calculate the FFT twice (two spectral averages). Since there are 128 points per FFT and.1ms between points, the simulation must run for 2*128*.1ms or 25.6 ms. 3. Before running the simulation, open the configuration parameters and reset the simulation stop time to 30 ms (slightly greater than the 25.6ms). Run the simulation. The Spectrum Scope window will open and you will see a small non zero value displayed. Zoom in to the area around this signal and you should see a display similar to the one shown below in figure 8. Figure 8. Spectrum Scope Display 4. We expect to see the peak of the signal displayed at 100 Hz. However, it is somewhere between 50 and 100 Hz. This is due to the resolution. Based on tutorial 2 we know that the resolution is only 1/NT s or 1/[(128)(.1ms)] = 78 Hz. This is too large for a 100 Hz signal. In order to change the resolution to 1Hz, we need N = 1/[1*Ts] = 10000. In the Spectrum Scope the length of the FFT must be a power of 2. Set the buffer size to 16384 since this is the smallest power of two that is larger than 10000. The simulation stop time also needs to be increased. Now we need to run the simulation for 2*16384*.1ms = 3.28 seconds. Set the

stop time to 3.5 and re-run the simulation. You should now observe the signal exactly at 100 Hz as shown below. Figure 8. Spectrum Scope Display. Modifying the Input Waveform 1. Add a second sine wave to the model. Set its frequency to 500Hz and its sample time to 1/10,000 to match the first sine wave. Return to the Library Browser and open the Math Operations sub-library. Select the Add block and add it to the model. Rewire the model so that it appears as shown below in figure 9. Figure 9. Model with Two Sources

2. Re-run the simulation. After zooming in on both the scope and spectrum scope displays the displays in figures 10 and 11 should be observed. Figure 10. Spectrum Scope Display of 100 and 500 Hz Sine Waves Figure 11. Scope Display of 100 and 500 Hz Sine Waves Filter Implementation 1. Select the Lowpass Filter from the DSP Systems Toolbox Filtering Filter Designs sublibrary and re-wire the model as shown in figure 12 below.

Figure 12. Model with Filter added 2. The objective is to set the parameters of the filter so that the 100 Hz signal will appear at the output and the 500Hz signal will be blocked. Double click on the Lowpass Filter block. Set the parameters as follows: Impulse Response: FIR Order mode: Minimum Filter type: Single-rate Frequency units: Hz Input Fs: 10000 Note: this is the sampling frequency of the system Fpass: 200 Fstop: 300 Magnitude units: db Apass: 0.01 Astop: 60 Design method: equiripple Structure: Direct-form FIR Input processing: Columns as channels Figure 13 below illustrates the definitions of these parameters. Note that the 100 Hz fits easily in the passband and the 500 Hz is in the stop band.

H db 0 Apass Astop fpass fstop Figure 13. Frequency Response of Lowpass Filter 3. Before closing the Lowpass Filter parameter window click on Apply and then View Filter Response. The frequency response of the resulting filter will be displaying. Confirm that this is the lowpass filter that you want. 4. Re-run the simulation. Based on the display in both the scope and the spectrum scope confirm that the 500 Hz signal has been eliminated. 5. Replace the Lowpass filter with a Highpass filter. Try setting the values to pass the 500 Hz signal and block the 100 Hz signal.