Fmincon - error using barrier
이전 댓글 표시
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개)
카테고리
도움말 센터 및 File Exchange에서 Nonlinear Optimization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!