MATLAB: Can anyone help me in optimizing (maximizing) the function of two variables

nonlinearoptimization

I have a function of two variables 'x1' and 'x2' and I want to maximise that function
F(x1,x2) = ((1 + x1/x2) * 725.2) – 398
subject to: x1 <= 5; x2 <= 120; x1 >= 1; x2 >= 40
Please help I shall be thankful

Best Answer

You don’t need matlab to find the maximum value of this function. The subtraction by 398 does not affect maximization, nor does multiplication by 725.2 or addition by 1. Therefore the problem is equivalent to finding x1 and x2 which maximize x1/x2. Since both are restricted to positive values, the maximum clearly occurs at maximum x1 and minimum x2, namely x1 = 5 and x2 = 40. All done without firing up matlab.