Multivariable Optimization problem with MATLAB
I wish to find a maximum for the following function, the function is m:
x = normrnd(0,1,[1,5]);
global x
xbar=mean(x);
global xbar
n=length(x);
global n
an = @(a0,b0,k0,m0) a0+n/2;
bn = @(a0,b0,k0,m0) (b0 + ((n-1) * sum((x-xbar).^2))/2 + ((k0 * n * ((xbar-m0).^2) )/(2*(k0 + n))));
kn = @(a0,b0,k0,m0) (k0 + n);
mn = @(a0,b0,k0,m0) ((k0 * m0)+(n.*xbar))/(k0 + n);
m=@(a0,b0,k0,m0)(gamma(an(a0,b0,k0,m0))/gamma(a0)) * ((b0^a0)/(bn(a0,b0,k0,m0).^an(a0,b0,k0,m0))) * (sqrt(k0/kn(a0,b0,k0,m0))) * ((2*pi)^(-n/2))
This is not linear. I wish to find a Global maximum. Most of the function I found in matlab handles the polynomials. But I do not find any particular function that gives me a maximum for this. I tried to use ‘fminunc’. But that is showing me an error message
"Failure in initial objective function evaluation. FMINUNC cannot continue."
Looking forward to some help. Thanks in advance.I wish to find a maximum for the following function, the function is m:
x = normrnd(0,1,[1,5]);
global x
xbar=mean(x);
global xbar
n=length(x);
global n
an = @(a0,b0,k0,m0) a0+n/2;
bn = @(a0,b0,k0,m0) (b0 + ((n-1) * sum((x-xbar).^2))/2 + ((k0 * n * ((xbar-m0).^2) )/(2*(k0 + n))));
kn = @(a0,b0,k0,m0) (k0 + n);
mn = @(a0,b0,k0,m0) ((k0 * m0)+(n.*xbar))/(k0 + n);
m=@(a0,b0,k0,m0)(gamma(an(a0,b0,k0,m0))/gamma(a0)) * ((b0^a0)/(bn(a0,b0,k0,m0).^an(a0,b0,k0,m0))) * (sqrt(k0/kn(a0,b0,k0,m0))) * ((2*pi)^(-n/2))
This is not linear. I wish to find a Global maximum. Most of the function I found in matlab handles the polynomials. But I do not find any particular function that gives me a maximum for this. I tried to use ‘fminunc’. But that is showing me an error message
"Failure in initial objective function evaluation. FMINUNC cannot continue."
Looking forward to some help. Thanks in advance. I wish to find a maximum for the following function, the function is m:
x = normrnd(0,1,[1,5]);
global x
xbar=mean(x);
global xbar
n=length(x);
global n
an = @(a0,b0,k0,m0) a0+n/2;
bn = @(a0,b0,k0,m0) (b0 + ((n-1) * sum((x-xbar).^2))/2 + ((k0 * n * ((xbar-m0).^2) )/(2*(k0 + n))));
kn = @(a0,b0,k0,m0) (k0 + n);
mn = @(a0,b0,k0,m0) ((k0 * m0)+(n.*xbar))/(k0 + n);
m=@(a0,b0,k0,m0)(gamma(an(a0,b0,k0,m0))/gamma(a0)) * ((b0^a0)/(bn(a0,b0,k0,m0).^an(a0,b0,k0,m0))) * (sqrt(k0/kn(a0,b0,k0,m0))) * ((2*pi)^(-n/2))
This is not linear. I wish to find a Global maximum. Most of the function I found in matlab handles the polynomials. But I do not find any particular function that gives me a maximum for this. I tried to use ‘fminunc’. But that is showing me an error message
"Failure in initial objective function evaluation. FMINUNC cannot continue."
Looking forward to some help. Thanks in advance. optimization MATLAB Answers — New Questions