Maximum Likelihood Estimation for function with several variables
4 ビュー (過去 30 日間)
古いコメントを表示
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.
Thanks in advance.
0 件のコメント
回答 (1 件)
Vinod Sudheesh
2014 年 9 月 29 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Geometry and Mesh についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!