# Maximum Likelihood Estimation for function with several variables

16 Ansichten (letzte 30 Tage)
Amit am 18 Sep. 2014
Beantwortet: Vinod Sudheesh am 29 Sep. 2014
I have a function in four variables and I need to find out the variable values where the function will have maximum value.
fn = (1-v1*v2*v3*v4)*(1-v1*v2*v4)*(1-v1*v2*v3)^2
I need to know at what values of v1, v2, v3 and v4, the fn will have maximum values.
Also, I need to know how to solve this problem in MATLAB. Basically I have to write a program which can find the variables values for maximum fn.
What I know: is that we need to differentiate this equation with respect to v1, v2, v3 and v4, separately. To maximize the fn, make the differentiations equal to zero. Then, we will have four equations and four unknown. We can find several values of variables. Then, keep these values in the function and find out where at what values, the fn maximized.
Ultimately, I need to write a program in MATLAB. Please tell me how write the whole program for MATLAB.
##### 0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Antworten (1)

Vinod Sudheesh am 29 Sep. 2014
I understand that you would like to find the points where a function attains its maximum value.
The ‘fminunc’ function in Optimization Toolbox can be used to solve the above optimization problem.
Information on the ‘fminunc’ function can be found at:
For example, the maximum for the function in question can be found using the sample code below.
f=@(x)(-1)*(1-x(1)*x(2)*x(3)*x(4))*(1-x(1)*x(2)*x(4))*(1-x(1)*x(2)*x(3))^2;
options=optimoptions(@fminunc,'Algorithm','quasi-newton'); % Options for the fminunc function.
x0=[1 1 1 1]; % Starting point for the algorithm.
[X,fval]=fminunc(f,x0,options); % Invoke the optimization algorithm.
Note that the original maximization problem has been converted to a minimization problem so that ‘fminunc’ can be used.
‘X’ contains the points where the local maximum is attained and ‘fval’ contains the function value at the local maximum.
It is important to note that ‘fminunc’ only finds the local maximum near the starting point 'x0’. As the original objective function is not a concave function, the answer returned by the ‘fminunc’ function may not be the global minimum.
##### 0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Kategorien

Find more on PDE Solvers in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!