Question: The built in MATLAB function MAX (and MIN) will determine both the location and value of the maximum (and minimum) element in an 1 times

The built in MATLAB function MAX (and MIN) will determine both the location and value of the maximum (and minimum) element in an 1 times n array. Write a MATLAB script which performs this task from scratch (i.e. you may not use the built in max or min functions). Have your script first prompt the user for the length of the array and then individually prompt him/her for the n numbers exactly as demonstrated below. Then have your script display to the screen the maximum value in the array and the index location. Output should (with the difference of user input) EXACTLY look like the following: Please enter your name == > Jeff Jeff, please enter how many numbers you have == > 4 Please enter number 1. Jeff == > 6 Please enter number 2 Jeff == > 7 Please enter number 3 Jeff == > 4 Please enter number 4 Jeff == > 5 The largest element 7 was found in location 2 The smallest element 4 was found in location 3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
