Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this is MATLAB! kindly do not leave any part it undone. this is just 2 parts of my assignment not the full assignment. Thank you!

this is MATLAB!
kindly do not leave any part it undone. this is just 2 parts of my assignment not the full assignment. Thank you! image text in transcribed
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 D) 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_kand_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

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

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago