Fmincon - error using barrier
1 回表示 (過去 30 日間)
古いコメントを表示
Hi all.
I would like get pmf's optimul value in entopy
I started simple test.
I changed pmf to pdf.
but it have some problem.
please, anyone help me?
clc;
clear all;
func = @(k)int_fun(k);
x0 = [0];
A = [];
b = [];
Aeq = [];
beq = [];
lb = [0];
ub = [1];
Q = fmincon(func,x0,A,b,Aeq,beq,lb,ub)
function [ F ] = int_fun(k)
fun = @(x) (-(k*dirac(x-1) + (1-k)*dirac(x+1)).*log(1./(k*dirac(x-1) + (1-k)*dirac(x+1))));
F=integral(fun,-inf,inf);
end
1 件のコメント
Ameer Hamza
2020 年 4 月 21 日
dirac() function gives infinity when its input is 1. It can cause issues in the function fun, making it impossible to integrate
fun = @(x) (-(k*dirac(x-1) + (1-k)*dirac(x+1)).*log(1./(k*dirac(x-1) + (1-k)*dirac(x+1))));
Can you show us the actual problem ad whar are you trying to optimize?
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Nonlinear Optimization についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!