Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started