Maximum of a function with elements from a vector
1 回表示 (過去 30 日間)
古いコメントを表示
Hello guys,
I want to find the maximum of the following function:
f(µ) = (1/n)*
log(
-µ)


where n=24 and
is a vector with 24 elements.

Can someone help me?
Many thanks in advance !!!
2 件のコメント
Ameer Hamza
2020 年 11 月 15 日
Is the objective function correct? In the current form, it seems that the maximum value is infinity.
回答 (1 件)
Ameer Hamza
2020 年 11 月 16 日
編集済み: Ameer Hamza
2020 年 11 月 16 日
You can define this objective function like this
u = 0; % for example
n = 24;
f = @(x) -1/n*sum(log(x-u));
x0 = rand(n,1);
fmincon(f, x0)
I used minus (-) with the objective function because MATLAB optimization functions are defined for minimization problem. This convert your problem from maximization to minimization.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!