Professional Documents
Culture Documents
Labexam1 Summer19
Labexam1 Summer19
LAB EXAM 1
Name:
ID:
1. Do a scatter plot of two vectors. Both vectors should be randomly generated and have size of 20. Add the following title to your
plot “scatter plot of random vectors”.
2. Write a MATLAB function that takes as input two vectors x and y, and returns rms(demean(x)), rms(demean(y)), and
cosine_distance(x,y), if the vectors are of the same dimension, otherwise displays the error message “dimension mismatch”.
3. Write a MATLAB function that inputs a vector x and a number n, and produces the matrix with n rows each containing vector x.
(you cannot use repmat()).
CSE 317 Numerical Methods [SET B] Time: 30 minutes
LAB EXAM 1
Name:
ID:
2. Write a MATLAB function that takes two vectors x and y and returns the projection of x on y and projection of y on x if x and y are
of the same length, otherwise returns “dimension mismatch”.
3. Write a MATLAB function that finds all indices of odd numbers between 1 and 10.