class2a_matlab_activities_engr195(II)s10

class2a_matlab_activities_engr195(II)s10 - ENGR 195(II)...

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

View Full Document Right Arrow Icon
ENGR 195(II) – Spring 2010 Activity 1 Class 2a Activity 1 - Assigning Vectors and Performing Mathematical Operations with Vectors (Estimated Time: 20 minutes) In this exercise, you and a partner will learn to assign vectors and perform vector element-by- element mathematical operations. 1. At the MATLAB prompt in the Command window, create a variable called Ascalar and assign it the value 3 . 2. Now you will learn to assign vectors to variable names. Vectors are just a series of numbers that are related in some way. a. At the MATLAB prompt in the Command Window, you will create a row vector called Arowvector and assign Arowvector the values starting from 0 and ending at 3 in increments of 1 . Create the row vector by typing (using square brackets): Arowvector = [0 1 2 3] You could also create Arowvector by typing: Arowvector = [0,1,2,3] b. Create a second row vector called Browvector with four elements of your choice. To keep this manageable, the value of each element should be an integer between -5 and 5. Browvector = __________________________________________ c. Create a third row vector called Crowvector with three elements of your choice. The value of each element should be an integer between -5 and 5. Crowvector = __________________________________________ d. Create a column vector called Acolvector . Assign Acolvector the same values assigned to Arowvector . To do this, type: Acolvector = [0;1;2;3] Note that the syntax for assigning a column vector is slightly different than the syntax for assigning a row vector. A semicolon indicates when a new row should start in a column
Background image of page 1

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

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

This note was uploaded on 08/25/2011 for the course ENGR 195 taught by Professor Staff during the Fall '08 term at Purdue.

Page1 / 4

class2a_matlab_activities_engr195(II)s10 - ENGR 195(II)...

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

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