Experiment 1 Introduction to MATLAB and Simulink

Similar documents
COMMUNICATION LABORATORY

Introduction to Simulink

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

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

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

Experiment 2 Effects of Filtering

Introduction to Simulink Assignment Companion Document

Experiment 1 Introduction to Simulink

ECE411 - Laboratory Exercise #1

Experiment 4 Detection of Antipodal Baseband Signals

ECEGR Lab #8: Introduction to Simulink

C.8 Comb filters 462 APPENDIX C. LABORATORY EXERCISES

ES442 Final Project AM & FM De/Modulation Using SIMULINK

EXPERIMENT 4 INTRODUCTION TO AMPLITUDE MODULATION SUBMITTED BY

Lab 1: Simulating Control Systems with Simulink and MATLAB

Laboratory Experiment #1 Introduction to Spectral Analysis

Lab 4 An FPGA Based Digital System Design ReadMeFirst

Use of the LTI Viewer and MUX Block in Simulink

Implementation of QAM Modulation Demodulation Based on. Simulink

Wireless Communication Systems Laboratory Lab#1: An introduction to basic digital baseband communication through MATLAB simulation Objective

FACULTY OF ENGINEERING LAB SHEET ETN3046 ANALOG AND DIGITAL COMMUNICATIONS TRIMESTER 1 (2018/2019) ADC2 Digital Carrier Modulation

DFT: Discrete Fourier Transform & Linear Signal Processing

Lab 1B LabVIEW Filter Signal

Practice 2. Baseband Communication

EE 210 Lab Exercise #3 Introduction to PSPICE

Measuring Modulations

Experiments #6. Convolution and Linear Time Invariant Systems

Pull Down Menu View Toolbar Design Toolbar

Problem Set 1 (Solutions are due Mon )

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

The oscilloscope and RC filters

RF Blockset For Use with Simulink

LabVIEW Day 2: Other loops, Other graphs

Alternative View of Frequency Modulation

ESE 150 Lab 04: The Discrete Fourier Transform (DFT)

Lab 1: First Order CT Systems, Blockdiagrams, Introduction

TSKS01 Digital Communication

Exploring QAM using LabView Simulation *

Lab 8. Signal Analysis Using Matlab Simulink

Laboratory 5: Spread Spectrum Communications

LAB II. INTRODUCTION TO LABVIEW

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

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

MASSACHUSETTS INSTITUTE OF TECHNOLOGY /6.071 Introduction to Electronics, Signals and Measurement Spring 2006

Experiment # 4. Frequency Modulation

Excel Tool: Plots of Data Sets

Objectives. Abstract. This PRO Lesson will examine the Fast Fourier Transformation (FFT) as follows:

ESE 150 Lab 04: The Discrete Fourier Transform (DFT)

SigCal32 User s Guide Version 3.0

Experiment 8: An AC Circuit

GE U111 HTT&TL, Lab 1: The Speed of Sound in Air, Acoustic Distance Measurement & Basic Concepts in MATLAB

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

The secondary MZM used to modulate the quadrature phase carrier produces a phase shifted version:

Modelling and Simulation of a DC Motor Drive

Matlab for CS6320 Beginners

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

Ultra Wideband Transceiver Design

CS/NEUR125 Brains, Minds, and Machines. Due: Wednesday, February 8

Ansoft Designer Tutorial ECE 584 October, 2004

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

ELG3311: EXPERIMENT 2 Simulation of a Transformer Performance

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

SigCalRP User s Guide

Software Simulation of Pulse Time Modulation Techniques

Type pwd on Unix did on Windows (followed by Return) at the Octave prompt to see the full path of Octave's working directory.

Combinational logic: Breadboard adders

Excel Lab 2: Plots of Data Sets

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

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

A time shift delay or advances the signal in time by a time interval +t 0 or t 0, without changing its shape.

ME 365 EXPERIMENT 8 FREQUENCY ANALYSIS

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

ENGR 210 Lab 12: Sampling and Aliasing

EITN90 Radar and Remote Sensing Lab 2

Lab 2: Introduction to Real Time Workshop

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

ArbStudio Triggers. Using Both Input & Output Trigger With ArbStudio APPLICATION BRIEF LAB912

Linear Motion Servo Plants: IP01 or IP02. Linear Experiment #0: Integration with WinCon. IP01 and IP02. Student Handout

LAB 2 SPECTRUM ANALYSIS OF PERIODIC SIGNALS

An Introductory Guide to Circuit Simulation using NI Multisim 12

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

EENG-201 Experiment # 4: Function Generator, Oscilloscope

Signal Processing Blockset

Basic Signals and Systems

LABORATORY - FREQUENCY ANALYSIS OF DISCRETE-TIME SIGNALS

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

Quadrature Amplitude Modulation (QAM) Experiments Using the National Instruments PXI-based Vector Signal Analyzer *

Sound synthesis with Pure Data

Math Labs. Activity 1: Rectangles and Rectangular Prisms Using Coordinates. Procedure

ECE 2713 Homework 7 DUE: 05/1/2018, 11:59 PM

EECS 307: Lab Handout 2 (FALL 2012)

3 USRP2 Hardware Implementation

Digital Video and Audio Processing. Winter term 2002/ 2003 Computer-based exercises

EE 464 Short-Time Fourier Transform Fall and Spectrogram. Many signals of importance have spectral content that

MATLAB Assignment. The Fourier Series

An Efficient Educational Approach for the Study of 16 QAM and Block Codes

14 fasttest. Multitone Audio Analyzer. Multitone and Synchronous FFT Concepts

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering. EIE2106 Signal and System Analysis Lab 2 Fourier series

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Circuits & Electronics Spring 2005

SIGNALS AND SYSTEMS: 3C1 LABORATORY 1. 1 Dr. David Corrigan Electronic and Electrical Engineering Dept.

Transcription:

Experiment 1 Introduction to MATLAB and Simulink INTRODUCTION MATLAB s Simulink is a powerful modeling tool capable of simulating complex digital communications systems under realistic conditions. It includes prepackaged blocks that encompass complete modulator, demodulator, coder, and decoder systems. There are also basic building blocks which can be combined to produce custom communications systems. Along with Simulink s basic blocks, there are blocksets for both communications and digital signal processing. To allow the testing and debugging of systems, there are a number of signal sinks which provide views of the signal in the time or frequency domain. Blocks to analyze the performance of a system are provided along with realistic channels which model impairments, such as noise and multipath distortion. A key point to remember is that Simulink is a sampled, discrete time system. This has implications for how fast a signal may change. MATLAB itself is an extensive mathematics tool that facilitates the manipulation of vectors and matrices and the calculation of complex equations using scalars, vectors and matrices. It possesses a number of tools for the plotting of data, including two and three dimensional graphs. There is an exhaustive set of functions which provide analytical tools like the Fourier Transform, Error and Complimentary Error (or Q) Functions. The purpose of this experiment is to acquaint the student with Simulink and provide a basic review of MATLAB. Students who are not familiar with MATLAB at all should refer to an excellent set of online tutorials at http://www.mathworks.com/academia/student_center/tutorials/launchpad.html. Information and tutorials about Simulink can be found at http://www.mathworks.com/academia/student_center/tutorials/simulink-launchpad.html.

PROCEDURE 1. MATLAB Tour and Review: Open MATLAB and verify that the arrangement of the desktop is as shown below: 2. Enter the following vectors in the Command Window at the >> prompt as shown below: g=[1 2 3 4]; h=[1 2 3 4]; Note the individual elements are separated by spaces. A semicolon would indicate a new row in a matrix. Also note the semicolon at the end of each entry. This tells MATLAB not to echo the entry or a result. 3. Multiply the two vectors using the * character, as shown: g*h Note: this returns an error. MATLAB uses the * character to indicate the multiplication of two matrices. 4. Multiply the two vectors using the.* character, as shown: g.*h This multiplies the vectors element by element, returning the squares of each number: 1 4 9 16 This also applies for division. Try g/h and g./h. 5. Add the two vectors as shown: g+h Notice that this returns a result, adding the two vectors term by term, even though there is no period before the plus sign. This is because matrix addition is defined as term by term. The same is true for subtraction. 6. Create a simple square matrix using the form: g=[1 2 3; 4 5 6; 7 8 9]

Omitting the semicolon on the end of the line will cause MATLAB to echo back the matrix as: g = 1 2 3 4 5 6 7 8 9 Now take the transpose of this matrix by entering: g This returns: ans = 1 4 7 2 5 8 3 6 9 Use the help menu to find other matrix and vector operations 7. Enter the following commands: for n =1:360 pi= 3.14159; bear = pi*n/180; g(n)=sin(bear); h(n)=cos(bear); end Notice that these vectors appear with information about them in the Workspace pane. Plot the g vector with the following command: plot(g) Observe that the Figure 1 window appears with the sine wave. Now enter: plot(h) Notice that the sine wave has been replaced by the cosine wave. Now investigate the hold on and subplot commands to first, plot both vectors on a single plot, using different colors for each (see the plot command for that). And second, to plot the vectors on two separate panes in the same figures window. Finally, investigate using the plot command to plot a limited range of the vectors. For example, from n= 90 to n=270. At any point you can get help on a command by typing help followed by the command. For more detailed help, enter doc followed by the command. 8. Now open Simulink, either by entering simulink on the command line or by clicking on the icon shown below in the tool bar. This will open the Library Browser for Simulink. 9. Open a new model. (Under the File pull down menu). This will open a new window. Save this model with a name you choose.

10. Notice the different block sets in the Library. Find the Random Integer Generator by either searching for it or opening the Communications Blockset. Drag and drop this block into your model. Double click on the block in your model to open the dialogue box. Set M-ary Number to 2 and leave the rest of the entries as default. Now enter Scope into the search bar of the Library Browser. Notice this yields a number of scopes. Drag the first Scope under Simulink s Sink Library to your model and connect its input to the output of the Random Integer Generator. This can be done by clicking on the input of the scope and dragging a line to the output of the generator. Run the simulation by clicking on the play arrow in the model toolbar. When the simulation finishes, double click on the Scope block and observe the output of the Generator. Run the simulation again. Notice you always get the same pattern of bits. Open the Random Integer Generator block and change the Initial Seed to another number. Run the simulation again several times. Notice you always get a certain pattern of bits, but the pattern depends on the Initial Seed. Find the simulation time entry in the model tool bar to the right of the play button. It should be a default of 10. Change this to 20 and observe the scope. Notice that Simulink does not play in real time. It completes the 20 second simulation in about one second or less. 11. Often it will be useful in this lab to make the sample rate higher than the bit rate, i.e to have more than one sample/bit. Drag the Ideal Rectangular Pulse Filter to the model and place it between the Generator and the Scope. Open the block and set the following: Pulse Length: 10 Input Sampling Mode: Sample-Based Linear Amplitude Gain: 10 This will increase the sample rate to 10 samples per bit. Notice you must increase the gain by the same amount to compensate for the increase in samples. Run the model. Use the scope to determine if the waveform is any different. 12. Insert a Spectrum Scope into the model at the output of the Rectangular Filter. Set the following parameters in the Spectrum Scope. Buffer Input (checked) Buffer Length 64 Buffer Overlap 0 Specify FFT Length (checked) FFT Length 64 Number of spectral averages 32 Leave the rest of the parameters at their defaults. Set the simulation time to 200 and run the system and observe the location of the first null in the Spectrum Scope. You may need to select Axis Autoscale to observe the display. You may see some dips in the spectrum but the first null will be below -10dB.

13. Repeat steps 11 and 12 with a Pulse Length of 20. Remember to change the Gain in the Rectangular Filter to 20. Also change the Buffer Length to 128 and the FFT length to 128. Observe any differences in your results. For example, how wide is your frequency spectrum now? Are the nulls at different frequencies? What has changed about the spectral display qualitatively, e.g. is it smoother or rougher? 14. Return the Pulse Length to 10 and remember to adjust the gain accordingly. Insert the AWGN Channel between the output of the Rectangular filter and the Scope. Set the number of axes on the Scope to 2. Connect the second Scope input to the output of the Rectangular Filter. Remove the Spectrum Scope. Set the Signal to Noise Ratio (SNR) to 100 db, set the Power to 1 and run the system for 10 seconds. Verify that the two traces on the Scope are identical. Set the Signal to Noise Ratio to 10 db and run the system again. Compare the two traces. You will see the noise is not a continuous waveform, but made up of 10 samples for each symbol. For simplicity, we will set the decision threshold for whether the signal is a one or zero at 0.5. For how many of these samples is the channel output greater than 0.5 when the channel input is a zero? How often is the reverse true, i.e. a 1 is sent and the channel output is below 0.5? Try this with other signal to noise ratios, such as 5, 15, 20 and 25 db. You may have to expand the display vertically using the magnifying glass icon in the Scope display. Set the Signal to Noise Ratio to -10 db and run the simulation. How often does the channel output agree with the input? THOUGHTS FOR CONCLUSION In your conclusion you should think about the following: What are the advantages and disadvantages of using this type of simulation? What would be the advantages and disadvantages of increasing the sample rate in step 11? What ways might you think of for improving the detection of the signal when it is corrupted by noise? What is the worst error rate possible (i.e. when the SNR is very small or even negative)? Do not limit your conclusion to these questions. Think about what the experiment means and where it leads for future work.