1. Write A Function File To Find Both The Minimum And Maximum Values Of Elements In A Vector And To Return Their Locations In The Vector I.e.elements 3 And 5 For Example). Use The Following As A Guideline Function (xminimin Xmax,imax] = Vec_min_max(x) % D

匿名用户 最后更新于 2021-12-01 18:55 其他 All Others


1. Write a function file to find both the minimum and maximum values of elements in a vector and to return their locations in the vector i.e.elements 3 and 5 for example). Use the following as a guideline function (xminimin xmax,imax] = vec_min_max(x) % date, student name % x is a vector % xmin = minimum element in vector x % imin = location of minimum element % xmax = maximum element in vector X % imax = location of maximum element % first check the length of the vector X n = length(x); xmin = x(1): xmax = x(1); for i = 1:n; % place if and elseif statements, etc. here % with the mathematical operations end % end of for loop end % end of function file confirm your results using the following vector x = [14.7 -12.3 33.2 41.7 12.1 27.0 -22.1 14.7 55.3 6.2 - 12.7]

已邀请: