Fmincon - error using barrier
Afficher commentaires plus anciens
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 commentaire
Ameer Hamza
le 21 Avr 2020
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?
Réponses (0)
Catégories
En savoir plus sur Nonlinear Optimization dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!