Professional Documents
Culture Documents
Q1:
(a) Create 10x10 matrix (say X) with even rows as even numbers and odd
rows as odd numbers with range of 200 to 300, with no repeated value.
(b) Take transpose of X and add to original X save it to S matrix, Take
transpose of X and subtract it from original X save it to A matrix.
(c) Append 5th row of matrix X to end of matrix A and 5th column of X to
end of matrix S, Compute Y as multiplication of A and S.
Add extra row or column of ones to A and S to make it square matrix if
needed
(d) Delete last row and last column of Y and make it 10x10 matrix and
Compute Y1 = A2 + S2
also compute inverse of Y1
Q3. Each of the five columns in matrix A represents the four exam grades
for a student in
a MATLAB programming class:
A = [ 89 97 55 72 95
100 92 63 85 91
82 96 71 91 82
90 98 48 83 70 ]
1. Give a command that sorts each students grades and returns a matrix
with the
sorted grades. Sort(A)
Question:4
a. Given a vector A = [12 62 93 -8 22];
b. Create a diagonal matrix from given vector by placing the vector one row below the main
diagonal.
c. Reshape 3-by-4 matrix A to have dimensions 2-by-6
Q3.a) ) Create a matrix A with dimension 10X10 with range of 250 to 350
without repeating any value, take 2nd, 5th, 7th, 9th rows of matrix A (using
indexing) and make a new matrix B using appropriate concatenation
method.
(b) Flip the B matrix along horizontal axis and sort the elements in
ascending order in both dimensions and shift it to the right along the
second (horizontal) dimension by three places and store these values in
matrix C.
Q4. Create a 4-by-6 matrix named A and shift it along both dimensions: three columns to the
Create a diagonal matrix from given vector by placing the vector one row below the main
diagonal.
e. Create a 4 X 4 matrix with ones on the diagonal and zeros elsewhere.
f. Given a vector A = [12 62 93 -8 22];
g. Create a diagonal matrix from given vector by placing the vector one row below the main
diagonal.
h. Reshape 3-by-4 matrix A to have dimensions 2-by-6