# CIVE121 Study Guide - Quiz Guide: Utilitarian Cake-Cutting, Standard Deviation, Euclidean Vector

22 views2 pages

Published on 27 Feb 2018

School

Department

Course

Professor

14. Vector functions

a. sum(a) finds sum of vector a

b. mean(a) finds average of vector a

c. std(a) finds standard deviation of vector a

d. length(a) finds length of vector a

e. min(a) finds minimum value in vector

f. max(a) finds maximum value in vector a

g. sort(a, ‘ascend or descend’) sorts vector a in ascending or descending order and

default is ascending order

h. *any of these operations on a matrix only does it for the column vectors of that

matrix

i. *if two inputs for max or min ([max, index]=max(a)), also gives index of max or

min value, if multiple max or min gives index of first one

j. *if two inputs for sort ([sorted_a, index]=sort(a))then outputs sorted vector as

well the original index in sorted positions

15. String functions

a. strrep(a, ‘b’, ‘c’) searches string a to replace b with c *is case sensitive

b. upper(a) makes string a all upper case

c. lower(a) makes string a all lower case

d. str2num(a) converts a string number a to the number

e. num2str(a) converts double a to a string

f. findstr(‘a’,b) finds index of first letter in string a inside string b

g. char(a,b) vertically concatenates strings a and b filling in spaces with empty space

16. Arrays

a. [a,b;c,d] makes array with a and b in first row and c and d in second row

b. a(b,c)=d creates array named a with value d at bth row and cth col with other

values as 0

c. a(b:c,d:e)=array creates array named a putting values from array into b to cth row

and d to eth col provided dimensions match, or if array=one number then all values in that range

is that number

find more resources at oneclass.com

find more resources at oneclass.com