Finding the span of a function in Matlab
<p>I am trying to create a Function M-file that will take in a function handle, a real number, and another real number. The output of the function being the span of the inputted function handle. I am assuming the second real number input is always bigger and that the inputted function is always a quadratic function.</p>

<p>span(f,a,b)</p>

<p>Essentially, the function will take in the function from the function handle (f) and then finds the maximum and minimum values of that function between the intervals [a,b] and then takes the difference of the 2, thus giving us the span.</p>

<p>I am relatively new to Matlab. I am wondering what would be the best way to find the max and min of a function given an interval in Matlab.</p>

<p>I was thinking of using the first derivative test to determine the critical points and then using the extreme value theorem to test all critical points including the end points (a and b) to find max and min.</p>