Question: Create 3 user defined local functions named mymax1, mymax2, mymax3, that carry out the work described below. The function named mymax1 should take one parameter
Create 3 user defined local functions named mymax1, mymax2, mymax3, that carry out the work described below. The function named mymax1 should take one parameter a that is a 1D array, and return the max scalar value in the given array, or [] if the array a is empty. The return value should be a scalar. Note that mymax1 function should produce the same results as the built-in function named max, when it is given an input parameter that is a 1D array. The function named mymax2 should take one parameter a, that is a 1D or 2D array. If the parameter a is a 2D array then mymax2 should return a row vector filled with the maximum value of each column in array a. If array a is 1D then mymax2 should return the max scalar value in the given array. If the array a is empty then mymax2 should return []. Note that mymax1 function should produce the same results as the built-in function named max, when it is given a 1D or 2D input parameter. The function named mymax3 should take one parameter a that is a 1D or 2D array, and return the maximum value in array a, that is a scalar value. Your functions mymax1, mymax2, mymax3 should use while loops with nested if else statements to calculate the values returned. Note: do not use the built in function named max in your functions named mymax1, mymax2, or mymax3. Begin your lab07.m by setting the random seed with the value of 1, i.e. rng(1); % Do this first, if you do not then you will get incorrect values. Then create 3 arrays named a,b,c, in the following order. a should be a row of 10 random integers r such that -5rng(1); % Do this first, if you do not then you will get incorrect values. a = randi([-5,5),1,10); b 200*rand(5,8) 100; c = 1000*rand (10,10); = Refer to Ch3 p77-80 in the text for more info on random numbers. pola. Use the mymax function to calculate the maximium value in a. poib. Use the mymax2 function to calculate the maximium value(s) in b. poic. Use the mymax3 function to calculate the maximium value in c. Your value should match the example output, use format short
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock

