1. Create a vector u of 201 equally spaced points in the range [1 , 4 ]. 3. Crea
ID: 1853171 • Letter: 1
Question
1. Create a vector u of 201 equally spaced points in the range [1 , 4 ].
3. Create a 42 x 42 array A with uniformly distributed random values.
4. Create a 1 x 42 array z with normally distributed random values.
5. Create an array B of ones for values, with B having the same dimensions as another,
already existing array C.
6. An ascii data file whose name is stored in a string variable filename has 5 columns of data.
Column 1 is numeric data; column 2 is string data, which I want to store in an array called
lnames; column 3 is numerical data, which I want to store in an array called scores; column
4 is string data, and column 5 is string data, which I want to store in an array called grades. I
want to read in only the data for lnames, scores, and grades, i.e. only the data in the 2nd , 3rd
and 5th columns of the data file.
Given vectors x and y, both of the same size, compute, for problems 7 - 9:
7. the sum of the cubes of the components of y,
8. the sum of the products of the components of x and y (I.e., the dot product of x with y).
9. the maximum of the values of the components of x, and where (which index) it occurs.
10. Plot a polygonal line segment using dashed black lines between the points (1,1), (2,0), and
(3,1).
11. Plot a closed polygonal line (triangle shape) using a solid blue line connecting (0,0), (2,0),
(2,2).
12. Given a non-negative numerical value of score, known to be between 0 and 100, assign a
value to the string variable fg, based on the standard A,B,C,D, F letter grade cutoffs. Use
the proper branching structure to do this.
Explanation / Answer
3) =random('poisson',42:42,42,42); 4)n2 = normrnd(0,1,[1 5]) 5)B=zeros(size(c)) 7)=y1^3+y2^3 8)x1*y1+x2*y2 9)max(max(x1),max(x2)) 10)plot((1,1), (2,0),(3,1),'k--') 11)plot((0,0), (2,0),(2,2),'b')
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.