MATLAB: Find the minimum value of y for positive vales of x

debug4mefindfunctionMATLAB

i have xmin=min(y(x>0)); where x=[-100:100] & y =x^3+60x^2-50 it gives me -50 which is wrong
aloso i have xmin=min(y(0:x(end))); where x=[-100:100] & y =x^3+60x^2-50 it gives me -50 which is wrong answer
any ideas? is my expression wrong ?

Best Answer

Try this
%%

x = (-100:100);
y = x.^3+60*(x.^2)-50;
%%
xmin = min(y(x>0))
which returns
xmin =
11
>>
Related Question