Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please do in matlab There are many useful functions in Matlab for manipulating matrices and vectors, like the diag tril, triu, reshape, and repmat functions.

Please do in matlab

There are many useful functions in Matlab for manipulating matrices and vectors, like the diag tril, triu, reshape, and repmat functions. The tril and triu can be used to return any portion of the lower and upper part of a matrix A, respectively. The reshape command allows you to change the dimensions of a matrix from n-by-m to p-by-q, provided mn = pq. For example,

A = reshape(1:25,[5 5]) produces the matrix

The repmat command allows you to create a matrix with a repeating pattern. For example, a = 1:2:9; A = repmat(a,[5 1]) produces the matrix

Note that this is just the row vector a repeated 5 times. Use the above functions, or any combination of them, in the problems below. Your code may not use any loops and you may not just input these matrices directly in Matlab. However, you may use any operations such as addition, subtraction, and multiplication. You may also use the additional Matlab functions diag, eye, and transpose. The code you produce should require no more than two lines and should generalize to any size matrix with the same pattern (try not to hardcode dimensions, use variables instead). (a) Produce the matrices

image text in transcribed

image text in transcribed

There are many useful functions in Matlab for manipulating matrices and vectors, like the diag tril, triu, reshape, and repeat functions. The tril and triu can be used to return any portion of the lower and upper part of a matrix A respectively. The reshape command allows you to change the dimensions of a matrix from n-by-m to p-by-, provided mnp . For example, A - reshape (1:25, [5 5)) produces the matrix [1 6 11 16 21 1 2 7 12 17 22 A = 3 8 13 18 23 1914 19 24 5 10 15 20 25 The repmat command allows you to create a matrix with a repeating pattern. For example, a = 112:9; A - repmat(a, [51]) produces the matrix Ti 3 5 7 9 1 A= 1 3 5 7 9 11 3 5 7 9 1 3 5 7 9 Note that this is just the row vector a repeated 5 times Use the above functions, or any combination of them, in the problems below. Your code may not use any loops and you may not just input these matrices directly in Matlab. However, you may use any operations such as addition, subtraction, and multiplication. You may also use the additional Matlab functions diag, eye, and transpose. The code you produce should require no more than two lines and should generalize to any size matrix with the same pattern (try not to hardcode dimensions, use variables instead). (a) Produce the matrices (a) Produce the matrices LO 6 11 16 21 0 0 12 17 22 0 0 0 18 23 0 0 0 0 24 0 0 0 0 0 O 00001 1 0 0 0 0 0 1 1 0 0 0 0 11 2 0 0 0 1 2 3 0 0 o 0 1 1 1 6 11 0 12 0 0 2 0 2 3 16 17 18 0 0 21 22 23 24 0 (b) Produce the matrices 6 6 6 6 6 [ 25 20 15 10 5] 24 19 14 94 23 18 13 3 . 22 17 12 7 2 21 16 11 6 1 12 15 12 15 12 15 12 15 12 15 0 20 15 10 51 24 0 14 94 23 18 0 8 3 22 17 12 0 2 21 16 11 6 0 -1 20 15 10 51 24-114 94 23 18 - 1 8 3 22 17 12 - 1 2 2116 116-1 (c) Produce the matrices 1 1 1 1 1 1 4 4 4 4 14999. 14 9 16 16 1 4 9 16 25 0 -4 -9 -16 -25 4 0 -9 -16 -25 9 9 0 -16 -25 16 25 16 25 16 25 025 -250 . -1 4 4 -4 99 16 16 25 25 9 9 -9 16 25 16 16 16 -16 25 25 25 25 25 25 There are many useful functions in Matlab for manipulating matrices and vectors, like the diag tril, triu, reshape, and repeat functions. The tril and triu can be used to return any portion of the lower and upper part of a matrix A respectively. The reshape command allows you to change the dimensions of a matrix from n-by-m to p-by-, provided mnp . For example, A - reshape (1:25, [5 5)) produces the matrix [1 6 11 16 21 1 2 7 12 17 22 A = 3 8 13 18 23 1914 19 24 5 10 15 20 25 The repmat command allows you to create a matrix with a repeating pattern. For example, a = 112:9; A - repmat(a, [51]) produces the matrix Ti 3 5 7 9 1 A= 1 3 5 7 9 11 3 5 7 9 1 3 5 7 9 Note that this is just the row vector a repeated 5 times Use the above functions, or any combination of them, in the problems below. Your code may not use any loops and you may not just input these matrices directly in Matlab. However, you may use any operations such as addition, subtraction, and multiplication. You may also use the additional Matlab functions diag, eye, and transpose. The code you produce should require no more than two lines and should generalize to any size matrix with the same pattern (try not to hardcode dimensions, use variables instead). (a) Produce the matrices (a) Produce the matrices LO 6 11 16 21 0 0 12 17 22 0 0 0 18 23 0 0 0 0 24 0 0 0 0 0 O 00001 1 0 0 0 0 0 1 1 0 0 0 0 11 2 0 0 0 1 2 3 0 0 o 0 1 1 1 6 11 0 12 0 0 2 0 2 3 16 17 18 0 0 21 22 23 24 0 (b) Produce the matrices 6 6 6 6 6 [ 25 20 15 10 5] 24 19 14 94 23 18 13 3 . 22 17 12 7 2 21 16 11 6 1 12 15 12 15 12 15 12 15 12 15 0 20 15 10 51 24 0 14 94 23 18 0 8 3 22 17 12 0 2 21 16 11 6 0 -1 20 15 10 51 24-114 94 23 18 - 1 8 3 22 17 12 - 1 2 2116 116-1 (c) Produce the matrices 1 1 1 1 1 1 4 4 4 4 14999. 14 9 16 16 1 4 9 16 25 0 -4 -9 -16 -25 4 0 -9 -16 -25 9 9 0 -16 -25 16 25 16 25 16 25 025 -250 . -1 4 4 -4 99 16 16 25 25 9 9 -9 16 25 16 16 16 -16 25 25 25 25 25 25

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions