Error with fmincon- too many input arguments
Afficher commentaires plus anciens
Hello, could you please help me solve with this question. I have build a function to calculate the likelihood function of a heston model.
function [ vix_likelihood_heston ] = likelihood_heston(vix, para_heston )
%Calculate the likelihood function of vix model using heston model
n = length(vix);
L = zeros(n,1);
c = zeros(n,1);
u = zeros(n,1);
v = zeros(n,1);
J = zeros(n,1);
mu = zeros(n,1);
for i = 1:n
c(i) = (2*para_heston(1))/(para_heston(3)*(1 - exp ( - para_heston(1)* (vix(i,7)/360))));
u(i) = c(i) * vix(i,8) * exp(- para_heston(1) * (vix(i,7)/360));
v(i) = c(i) * vix(i,9);
q = (2 * para_heston(1) * para_heston(2)/(para_heston(3)^2))-1;
mu(i) = sqrt(4*u(i)*v(i));
J(i) = besselj(q,mu(i));
L(i) = log(c(i)*exp(-u(i)-v(i))*((v(i)/u(i))^(q/2))*J(i));
end
vix_likelihood_heston = -sum(L);
end
I have test the function with initial parameters and it did return the value.
When I try to use the fmincon:
para_hes = fminsearch(@likelihood_heston,para0_hes,[],[],[],[],vix_in);
It shows the error:
Error using likelihood_heston
Too many input arguments.
Error in fminsearch (line 200) fv(:,1) = funfcn(x,varargin{:});
My function is attached.
I want to ask how to solve this problem?
Many thanks
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Probability Distributions and Hypothesis Tests 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!