{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

EGR_102_Lab_05A_Vector_Creation___Plotti

# EGR_102_Lab_05A_Vector_Creation___Plotti - MATLAB Vector...

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

MATLAB ® Vector Creation and Plotting EGR 102 - Lab 05A 1

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

View Full Document
MATLAB Vectors MATLAB vectors: Collections of numbers lined up Ordered or random, one-dimensional groups of scalars Row vectors contain numbers in a single row Column vectors contain numbers in a single column Write one command to apply a cell-by-cell operation to all elements of a vector using the dot operator Able to perform same operation on each cell of a vector Perform all operations in one step EGR 102 - Lab 05A 2
Vector Creation Vectors are defined using brackets where , separate columns ; separate rows a = [1, 2, 4] b = [9; 2; 7] Each value in a vector is called an element Numbered from left to right or top to bottom EGR 102 - Lab 05A 3

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

View Full Document
Vector Creation Concatenation: Create a new vector from two or more defined vectors >> x = [1,10]; >> y = [-10,x] >> z = [x,-10] The order of concatenation is important EGR 102 - Lab 05A 4
Vector Creation Concatenation: Distinguishes between column and row vectors >> a = [1;2;3]; >> b = [6;7;8]; >> c = [a;b] Use commas (,) to concatenate row vectors Use semicolons (;) to concatenate column vectors EGR 102 - Lab 05A 5

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

View Full Document
Vector Creation Two alternative methods to create ordered vectors with equal spacing: 1. Built-in function linspace() Used when you know exact number of elements in a vector 2. Colon operator (:) Used when you know the spacing between elements Both produce a row vector with equal spacing EGR 102 - Lab 05A 6
linspace() function

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 22

EGR_102_Lab_05A_Vector_Creation___Plotti - MATLAB Vector...

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

View Full Document
Ask a homework question - tutors are online