minimize the function, f(x1,x2) = -(x1/2) - (3*x2 / 2) in matlab

To minimize the function f(x1,x2) = -(x1/2) - (3*x2 / 2) in MATLAB, we can use the fminsearch built-in function.

Here is the MATLAB code to implement the minimization:

main.m
% Define the function
f = @(x) -(x(1)/2) - (3*x(2)/2);

% Define initial guess
x0 = [0, 0];

% Find minimum using fminsearch
x_min = fminsearch(f, x0)
151 chars
9 lines

This will output the coordinates of the minimum point of the function.

related categories

gistlibby LogSnag