Question: I just want answer for Exercise two! Thank you Exercise 1: Write a MATLAB script file that functions as follows: a) The script asks the

I just want answer for Exercise two! Thank you

I just want answer for Exercise two! Thank you Exercise 1: Write

a MATLAB script file that functions as follows: a) The script asks

Exercise 1: Write a MATLAB script file that functions as follows: a) The script asks the user to enter a digit greater than or equal to 3 and save it into a variable, num b) It then creates a magic matrix with the size given by num and save it into a variable, mag c) The script calculates the sum of each row of mag and save it into a vector, mag_r d) The script calculates the sum of each column of mag and save it into a vector, mag_c e) The script also computes the sum of all elements of the matrix mag and save it into variable, mag_s f) It then calculates the sum of each diagonal of mag and save it in variables, mag_dl and mag_d2 g) The script then prints all these variables on screen. Exercise 2: Write a MATLAB script that functions as follows: h) It takes from user two input numbers and saves these into a variables, rows and cols 1) It also asks the user to provide any number from 1 to 100, and saves it in a variable, number 1) It generates a matrix of random floating-point numbers, rand_matrix, with dimension rows x cols by making sure that the elements of the matrix are between 0 and number a) The script should have a command to count number of elements of the matrix that are greater than or equal to number/2 k) Write a set of commands that generate another matrix, larger_rand_matrix that should have most of the elements greater than or equal to number/2 D) Write a set of commands that generate another matrix, smaller_rand_matrix that should have most of the elements smaller than number/2 b) Compare the output of step d, e and c) Floor the rand_matrix and save it in another matrix, floor_rand_matrix d) Ceil the rand_matrix and save it in another matrix, ceil_rand_matrix m) Write a command that generates a matrix of random set of integers between 0 and number with dimension rows x cols e) Display all variables on screen in a neat way Exercise 2: Write a MATLAB script that functions as follows: ah) It takes from user two input numbers and saves these into a variables, rows and cols 6) It also asks the user to provide any number from 1 to 100, and saves it in a variable, number It generates a matrix of random floating-point numbers, rand_matrix, with dimension rows x cols by making sure that the elements of the matrix are between 0 and number a) The script should have a command to count number of elements of the matrix that are greater than or equal to number/2 e ) Write a set of commands that generate another matrix, larger_rand_matrix that should have most of the elements greater than or equal to number/2 F 1) Write a set of commands that generate another matrix, amaller_rand_matrix that should have most of the elements smaller than number/2 9. Compare the output of step d, e and c) Floor the rand_matrix and save it in another matrix, floor_rand_matrix d) Ceil the rand_matrix and save it in another matrix, ceil_rand_matrix m) Write a command that generates a matrix of random set of integers between 0 and number with dimension rows * cols c) Display all variables on screen in a neat way

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!