Lab 0a: Introduction to MATLAB

Similar documents
Introduction to MATLAB LAB 1

Constraint-based Metabolic Reconstructions & Analysis H. Scott Hinton. Matlab Tutorial. Lesson: Matlab Tutorial

MATLAB Programming for Numerical Computation Dr. Niket Kaisare Department Of Chemical Engineering Indian Institute of Technology, Madras

INTRODUCTION TO MATLAB, SIMULINK, AND THE COMMUNICATION TOOLBOX

7 Control Structures, Logical Statements

Vector: A series of scalars contained in a column or row. Dimensions: How many rows and columns a vector or matrix has.

Computer Vision. Matlab

FreeMat Tutorial. 3x + 4y 2z = 5 2x 5y + z = 8 x x + 3y = -1 xx

Lab of COMP 406. MATLAB: Quick Start. Lab tutor : Gene Yu Zhao Mailbox: or Lab 1: 11th Sep, 2013

Boolean Logic & Branching Lab Conditional Tests

ELEC4042 Signal Processing 2 MATLAB Review (prepared by A/Prof Ambikairajah)

SECTION 5: STRUCTURED PROGRAMMING IN MATLAB. ENGR 112 Introduction to Engineering Computing

Introduction to Matlab. By: Hossein Hamooni Fall 2014

McTutorial: A MATLAB Tutorial

Complex Dynamic Systems

MATLAB TUTORIAL WORKSHEET

ECE 202 LAB 3 ADVANCED MATLAB

Matlab Tutorial for COMP24111 (includes exercise 1)

Introduction to MATLAB

Programming Language and Translator

Introduction to MATLAB

Lecture 4: Matrix Transformations, MatLab Scripts & Functions, Serial Communication Professor Carr Everbach

Matlab Tutorial, CDS

Matlab and Octave: Quick Introduction and Examples 1 Basics

Desktop Command window

Matlab (Matrix laboratory) is an interactive software system for numerical computations and graphics.

APPM 2460 Matlab Basics

SECTION 2: PROGRAMMING WITH MATLAB. MAE 4020/5020 Numerical Methods with MATLAB

LESSON 3. In this lesson you will learn about the conditional and looping constructs that allow you to control the flow of a PHP script.

Introduction. Matlab for Psychologists. Overview. Coding v. button clicking. Hello, nice to meet you. Variables

A/D Converter. Sampling. Figure 1.1: Block Diagram of a DSP System

Math 2250 MATLAB TUTORIAL Fall 2005

Introduction to. The Help System. Variable and Memory Management. Matrices Generation. Interactive Calculations. Vectors and Matrices

Introduction to Matlab

Computer Packet 1 Row Operations + Freemat

MATLAB INTRODUCTION. Risk analysis lab Ceffer Attila. PhD student BUTE Department Of Networked Systems and Services

EE 301 Signals & Systems I MATLAB Tutorial with Questions

Chapter 1 Introduction to SAS/IML Software

Scilab Programming. The open source platform for numerical computation. Satish Annigeri Ph.D.

Computational Modelling 102 (Scientific Programming) Tutorials

MATLAB Operators, control flow and scripting. Edited by Péter Vass

Introduction to Matlab. By: Dr. Maher O. EL-Ghossain

Matlab Tutorial and Exercises for COMP61021

Experiment 1: Introduction to MATLAB I. Introduction. 1.1 Objectives and Expectations: 1.2 What is MATLAB?

EE 216 Experiment 1. MATLAB Structure and Use

STAT/MATH 395 A - PROBABILITY II UW Winter Quarter Matlab Tutorial

AMATH 352: MATLAB Tutorial written by Peter Blossey Department of Applied Mathematics University of Washington Seattle, WA

MATLAB. Devon Cormack and James Staley

16.06/16.07 Matlab/Simulink Tutorial

Introduction to Matlab. High-Level Computer Vision Summer Semester 2015

EGR 111 Introduction to MATLAB

AN INTRODUCTION TO MATLAB

Introduction to Matlab

Introduction to Matlab

MATLAB Basics. Configure a MATLAB Package 6/7/2017. Stanley Liang, PhD York University. Get a MATLAB Student License on Matworks

function [s p] = sumprod (f, g)

Creates a 1 X 1 matrix (scalar) with a value of 1 in the column 1, row 1 position and prints the matrix aaa in the command window.

Introduction to Scientific Programming in MATLAB

MATLAB Project: Getting Started with MATLAB

1 Overview of the standard Matlab syntax

Sphero Lightning Lab Cheat Sheet

Introduction to MATLAB. Simon O Keefe Non-Standard Computation Group

9. Elementary Algebraic and Transcendental Scalar Functions

Lab 4-2 Create an Activity Diagram

Variable Definition and Statement Suppression You can create your own variables, and assign them values using = >> a = a = 3.

DSP Laboratory (EELE 4110) Lab#1 Introduction to Matlab

Page 1 of 11 Name/SID: SOLUTIONS UNIVERSITY OF CALIFORNIA COLLEGE OF ENGINEERING

EGR 102 Introduction to Engineering Modeling. Lab 05A Managing Data

Dr. Nahid Sanzida b e. uet .ac.

Some elements for Matlab programming

Introduction to Mathematical Programming

Access Groups. Collect and Store. Text Currency Date/Time. Tables Fields Data Type. You Your Friend Your Parent. Unique information

1) Generate a vector of the even numbers between 5 and 50.

MATLAB BASICS. M Files. Objectives

OUTLINES. Variable names in MATLAB. Matrices, Vectors and Scalar. Entering a vector Colon operator ( : ) Mathematical operations on vectors.

UNIVERSITI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER

Getting To Know Matlab

MATH (CRN 13695) Lab 1: Basics for Linear Algebra and Matlab

Teaching Manual Math 2131

Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++

ENGR 1181 MATLAB 02: Array Creation

Introduction to MATLAB

Introduction to MATLAB programming: Fundamentals

General Instructions. You can use QtSpim simulator to work on these assignments.

Programming in MATLAB

MATLAB Tutorial. Digital Signal Processing. Course Details. Topics. MATLAB Environment. Introduction. Digital Signal Processing (DSP)

Python lab session 1

1) As a logical statement, is 1 considered true or false in MATLAB? Explain your answer.

Array Creation ENGR 1181 MATLAB 2

CS129: Introduction to Matlab (Code)

Course Layout. Go to follow instr. Accessible within campus (only for the first download)

FPGA Co-Simulation of Gaussian Filter Algorithm Application Note

FACULTY OF ENGINEERING LAB SHEET INFORMATION THEORY AND ERROR CODING ETM 2126 ETN2126 TRIMESTER 2 (2011/2012)

MATLAB Project: Getting Started with MATLAB

Matlab and Vectors. next page. close. exit. Math 45 Linear Algebra. David Arnold.

Introduction to MATLAB

Functions. Systems Programming Concepts

COMP 111 PROGRAMMING I MODULARITY USING FUNCTIONS

Chapters 6-7. User-Defined Functions

Page 1 of 7 E7 Spring 2009 Midterm I SID: UNIVERSITY OF CALIFORNIA, BERKELEY Department of Civil and Environmental Engineering. Practice Midterm 01

Transcription:

http://www.comm.utoronto.ca/~dkundur/course/real-time-digital-signal-processing/ Page 1 of 1 Lab 0a: Introduction to MATLAB Professor Deepa Kundur Introduction and Background Welcome to your first real-time DSP lab. The purpose of this lab, and the next one is to introduce you to two of the software tools that you ll be using in this course, namely MATLAB and Simulink. These tools significantly aid the design, development and implementation of digital signal processing (DSP) algorithms. These tools have several advantages. One of the most significant for this course is that they make it somewhat unnecessary to program DSP hardware using low-level assembly language! This helps to better integrate the design phase (in software) and implementation phase (in hardware) steps of DSP system development resulting in more effective DSP solutions for a given application and rapid prototyping. Lab Instructions Go online to: http://www.mathworks.com/academia/student_center/tutorials/launchpad.html and select the Interactive MATLAB Tutorial. You will need to register for this tutorial, which will take approximately 2-2.5 hours to complete. Deliverables You must provide answers to the following questions (on pages 3-6 of this lab). Please write directly on the sheets and hand in your solutions by the end of the lab.

http://www.comm.utoronto.ca/~dkundur/course/real-time-digital-signal-processing/ Page 2 of 2 You must each separately answer the following questions on these lab sheets to be submitted (to the TA) at the end of the lab. You may use the back of the sheets if necessary. Questions: 1. What are MATLAB command(s) to create the matrix: 1 2 3 A = 4 5 6? 7 8 9 2. Provide MATLAB commands(s) to create a vector consisting of all the EVEN numbers between 21 and 65 in ascending order without having to exhaustively enter them. 3. Assume we have a 1 4 vector x = [4 5 2 6] stored in MATLAB. Translate the following operations into simple MATLAB commands one would enter at the MATLAB prompt that make use of x: a. Add 16 to each element of the vector x to produce another vector with the results. b. Add 3 to only the ODD-index elements (i.e., the first and third elements) of x to produce another vector with the results. c. Create a vector where each element value is the square root of each element of x. d. Create a vector where each element value is the square of each element of x.

http://www.comm.utoronto.ca/~dkundur/course/real-time-digital-signal-processing/ Page 3 of 3 4. Evaluate the following MATLAB expressions by hand first and then verify via MATLAB. Please provide your handwork as well as the final numerical results next to the corresponding expression. a. 2 / 2 * 3 b. 6-2 / 5 + 7 ^ 2 1 c. 10 / 2 \ 5-3 + 2 * 4 d. 3 ^ 2 / 4 e. 3 ^ 2 ^ 2 f. 2 + round(6 / 9 + 3 * 2) / 2 3 g. 2 + floor(6 / 9 + 3 * 2) / 2 3 h. 2 + ceil(6 / 9 + 3 * 2) / 2 3 5. Given the array A = [2 7 9 7 ; 3 1 5 6 ; 8 1 2 5], provide a single-line MATLAB command for the following operations to process A: a. assign the even-numbered columns of A to an array called B; what is the value of B? b. assign the odd-numbered rows of A to an array called C; what is the value of C? c. assign the transpose of A to a new array D: what is the value of D and what are its dimensions? d. multiply A with its transpose to produce a new array E; what is the value of E? 6. In your own words describe the following logical commands in MATLAB (i.e., explain the meaning of the symbols) and provide the final results for x=7 and y=-4: a. x > y

http://www.comm.utoronto.ca/~dkundur/course/real-time-digital-signal-processing/ Page 4 of 4 b. y < x c. x == y d. x <= y e. y >= x f. x y g. x & y h. x & (~y) i. (x > y) (y < x) j. (x > y) & (y < x) 7. Which of the following statements regarding the writing M-file functions in MATLAB are correct? a. M-file functions make tasks more modular and the code more reusable. b. M-file functions and scripts share the same workspace. c. M-file functions enable the explicit passing of inputs and outputs. d. M-files functions maintain a separate workspace that is automatically cleared on exit of the function. 8. Consider the following MATLAB code fragment: if n > 1 else end m = n+1 m = n-1 and use MATLAB to evaluate the value of m for (please write your answers next to the corresponding value of n below): a. n = 7

http://www.comm.utoronto.ca/~dkundur/course/real-time-digital-signal-processing/ Page 5 of 5 b. n = 0 c. n = -10 9. Evaluate the following MATLAB code fragment: if (x>0)&(x<10) y = 4*x elseif (x>10)&(x<40) else end y = 10*x y = 500 and use MATLAB to evaluate y for (please write your answers next to the corresponding value of x below): a. x = -1 b. x = 5 c. x = 30 d. x = 100 10. State whether the following states are TRUE or FALSE: a. Data defined in the workspace is permanently saved in MATLAB. b. A variable is a container for data in MATLAB. c. Function declarations always begin with the function keyword. They can have zero to multiple inputs and outputs. Multiple outputs are specified in square brackets separate by commas.