EE200_matlab_intro

EE200_matlab_intro - Last Revised: 9/3/2008 1 EE 200 Lab 1...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Last Revised: 9/3/2008 1 EE 200 Lab 1 - Matlab? 1 Introduction In this lab you will be introduced to Matlab® and its features and functions that are pertinent to EE 200. This lab is written with the assumption that students have some familiarity with programming languages and constructs but have not used Matlab before this course. 2 What you will learn This lab will focus on using Matlab to create signals (vectors and matrices in Matlab® speak). With this ability you will be prepared for the future lab exercises. 3 Background Information and Notes Matlab is the leading standard software package for modeling signals and systems. The reason for this is the ease with which it allows one to represent and define signals. Data is represented as arrays of varying dimensions. A scalar is a single number (which can be thought of as a zero dimensional array). A vector is a 1-D array (1xN / Nx1 sequence of numbers). A matrix is a 2-D array (an MxN array of numbers where M=# of rows and N=# of columns). Higher dimension arrays can also be used (3-D arrays are common when representing images and other data). [Note: Unlike some other computer languages, variables in Matlab do not have to be declared ahead of time and can be created at any point in time. Similarly vector and matrix variables can be resized on the fly (i.e. if initially x was a 1x4 row vector, assigning a new value to the 5 th column will make x a 1x5 vector).] The other advantage of Matlab is the wide array of built-in functions and processing techniques that can work on these data types whether they are scalars, vectors, or even matrices. As you work with these functions you can always get more information and help by typing “help function_name ” at the prompt (e.g. >> help plot). 4 Guided Exercises Let us focus on different data representation techniques in Matlab by providing some examples. Though some of these examples are obvious, you are encouraged to actually type these in at the command prompt to see the effect. Important : In Matlab, the default is to print the result of each statement or line to the screen. However, this is often undesirable, especially for large vectors and matrices. To suppress printing of the result, end each statement with a semicolon (;). Example: Entering: x = 1+1 at the prompt will print ‘2’ EE 200 Lab 1- Matlab? 2 Last Revised: 9/3/2008 to the screen. Entering: x = 1+1; will suppress the result being printed, though x will still be assigned the value of 2. a. Scalars : Scalar variables are single values (i.e. dimensions of 1x1 ) The following are examples of scalar variable creation/assignment. >> x = 5 >> y = 8.2e5 % notice the use of scientific notation …same as y=820000 >> z = -1.26e-3 % same as z = -0.00126 b. Vectors : Vectors are one dimensional arrays. A 1xn vectors is known as a row vector since all n elements are located in a single row. A nx1 vector is a column vector. Row and column vectors are simply the transpose of each other and can...
View Full Document

This note was uploaded on 04/05/2009 for the course EE 30446 taught by Professor Zadeh during the Spring '08 term at USC.

Page1 / 7

EE200_matlab_intro - Last Revised: 9/3/2008 1 EE 200 Lab 1...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online