Question: I need the code to be put in MATLAB for max and min in an array. Questions: If x is a array variable, what is
3. Write MATLAB code to give minimum and maximum values of xl and x2. EDITOR=>New=>Script In the Editor window, type the codes to find minimum and maximum values. When you are happy with your codes, make functions from them (save .m file) called myMin and myMax,respectively. Answer: (use Editor Window, not the Command window) Find minimum value % % myMin: return the minimum value of an array % function min_val= myMin(x) min val - x(1); % Get an initial guess for the max for k=2: length(x) % Now go through the rest of the array, 1 element at a time if(x(k)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
