It seems that the function f is not defined in the right way. Here f is a function that takes 'portion_alpha' as an argument and returns 'minus_profit'. 'minus_profit' isn't even defined in the function and hence the value of the same is taken from the defenition before.
If you try to run the following command, it would result in a logical array of 1s. This means that the function is invariant to the input argument; or in other words, function is constant.
>> f(1) == f(2)
I think you should try to define the function in the right way and see if f(x) for different values of x are giving you the answers as expected.