Write a function file in matlab that performs gradient-based optimization and determine the maxima, minima, and inflection points for the following function over range 0 to 4. Determine what your inputs and outputs should be. x 6 -10x 5 +36x 4 -58x 3 +43x 2 -12x-13 Solution t=[0:0.1:20]; y=exp(-t).*sin(pi./2.*t); %Our Function yAbs=abs(y); %Take the absolute value of the function. yMaxMin=zeros(201); %Create an array of zeros to be filled w/ data. for(i=2:200) %If a point is a maxima in yAbs, it will be a maxima or a minima in y. if(yAbs(i-1) yAbs(i)) plotPoint=yAbs(i); %If the value is a max, store it in plotPoint. end yMaxMin(i)=plotPoint; %Store the value of plotPoint into yMaxMin(i) end plot(t,yAbs); hold on plot(t,yMaxMin); .