Question: Programming: MATLAB 2. (Submatrices) In this problem, you will produce a new matrix as a submatrix from a given one, but still padded with zeros

Programming: MATLAB
2. (Submatrices) In this problem, you will produce a new matrix as a submatrix from a given one, but still padded with zeros to be the same size as the original. padded_sub_mat Function: Input parameters: . an m x n matrix A (note: the dimensions are not passed in) four scalars which represent the first and last row and first and last column of a submatrix to extract Output parameters: . a new matrix which is the same size as A which consists of all 0 entries except with a submatrix drawn from A and placed in the appropriate location A possible sample case is: for ir 1.0 1.0 >> mat_B = padded_sub_mat([1:4 ; 2:5 ; 3:6 ; 4:7], 2, 3, 3, 4) mat_B = 0 0 O 0 0 0 4 5 0 0 5 6 0 0 0 3. (Random Matrices) rand_mat_and_entry Function: Input parameters: two scalars representing the number of rows m and columns n of the desired matrix two scalars representing the minimum and maximum values desired (as floating point numbers) in the matrix Output parameters: . an m xn matrix A with randomly chosen floating point entries between the desired minimum and maximum values . a scalar which is a randomly selected entry from the matrix produced (note: to do this, you will have to randomly select a row then a column after producing the matrix or else your random numbers won't match mine in the autograder) A possible sample case is: >> [mat_A, ran_entry] = rand_mat_and_entry(3, 4, 0, 10) mat_A = 8.66802 9.12651 0.93661 1.66461 7.40808 7.61565 8.92578 1.49912 8.95304 1.60330 7.37412 3.64944 rand_entry - 7.40808 2. (Submatrices) In this problem, you will produce a new matrix as a submatrix from a given one, but still padded with zeros to be the same size as the original. padded_sub_mat Function: Input parameters: . an m x n matrix A (note: the dimensions are not passed in) four scalars which represent the first and last row and first and last column of a submatrix to extract Output parameters: . a new matrix which is the same size as A which consists of all 0 entries except with a submatrix drawn from A and placed in the appropriate location A possible sample case is: for ir 1.0 1.0 >> mat_B = padded_sub_mat([1:4 ; 2:5 ; 3:6 ; 4:7], 2, 3, 3, 4) mat_B = 0 0 O 0 0 0 4 5 0 0 5 6 0 0 0 3. (Random Matrices) rand_mat_and_entry Function: Input parameters: two scalars representing the number of rows m and columns n of the desired matrix two scalars representing the minimum and maximum values desired (as floating point numbers) in the matrix Output parameters: . an m xn matrix A with randomly chosen floating point entries between the desired minimum and maximum values . a scalar which is a randomly selected entry from the matrix produced (note: to do this, you will have to randomly select a row then a column after producing the matrix or else your random numbers won't match mine in the autograder) A possible sample case is: >> [mat_A, ran_entry] = rand_mat_and_entry(3, 4, 0, 10) mat_A = 8.66802 9.12651 0.93661 1.66461 7.40808 7.61565 8.92578 1.49912 8.95304 1.60330 7.37412 3.64944 rand_entry - 7.40808
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
