Question: 1- Create a new primary function that is called MY_Max which will take x as input argument, and return y as output argument and save

1- Create a new primary function that is called MY_Max which will take x as input argument, and return y as output argument and save it. The input variable x is a 2-D array which is matrix, and y is the returned maximum value.

2- The function will do the following:

a. Evaluate the size of x using size(x). The number of rows is assigned to row and the number of columns is assigned to col.

b. Initialize the maximum value y to the first value of x(1,1)

c. You need to find the maximum value of the matrix using two nested for loops. i. Do not use the buid-in max() function ii. Use two nested for loops to go over each element in x iii. Use if statement within the inner loop to test the new value

if (x(r,c) > y)

y=z(r,c);

end

3- You need to test your function by doing the following on the command window:

a. Create a random matrix z of any size. For example use the following command:

>> z=rand(10,5);

b. Use the build-in max() function to find the maximum value of z

Max1= max(max(z))

c. Call My_max as follows

Max2=My_MAX(z)

d. The two values Max1 and Max2 should be equal.

1- Create a new primary function that is called MY_Max which will

1 Create a new primary function that is called MY Max which will take x as input argument, and return y as output argument and save it. The input variable xis a 2-D array which is matrix, and y is the returned maximum value. The function will do the following: 2- a. Evaluate the size of x using size(x). The number of rows is assigned to row and the b. c. number of columns is assigned to col. Initialize the maximum value y to the first value of x(1,1) You need to find the maximum value of the matrix using two nested for loops. i. Do not use the buid-in max() function ii. Use two nested for loops to go over each element in x ii. Use if statement within the inner loop to test the new value MIN as follows: if (x(r,c) >y) y=z(r,c); end 3- You need to test your function by doing the following on the command window: a. Create a random matrix z of any size. For example use the following command: >>z-rand(10,5); b. Use the build-in max() function to find the maximum value of z C. Call My_max as follows d. The two values Max1 and Max2 should be equal Max1- max(max(z)) Max2-My_MAX(z)

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!