I'm trying to write an M-file that finds the max/min of a function, given a certain range.
Let's say I have defined an equation in the command window like so:
> y = @(x) -1*x^2 + 3
y =
function_handle with value:
@(x)-1*x^2+3
And let's say my desired range is from -3 to 3... So I would start my M-file with
function fminmax = input(f, lowerbound, upperbound)
but then what would I use? I've been googling for a while and I cant find anything helpful. Please help!