EE200_matlab_intro

# EE200_matlab_intro - EE 200 Lab 1 Matlab 1 Introduction In...

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

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’

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

View Full Document
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 be converted by using the transpose operator (‘). Elements of a vector can be specified explicitly or specified using the start:end or start:step:end notation.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern