Serving the Quantitative Finance Community

 
User avatar
MF01
Topic Author
Posts: 0
Joined: August 5th, 2005, 8:13 am

Matlab fmincon error message

February 9th, 2007, 9:40 am

Hi I am trying to maximise log likelihood function of 5 parameters using fmincon, with constraints on two of its parameters which I provide using confun . As far as I can see , I am doing it as Matlab help suggests, but I am getting an error message , " conversion to struct from double is not possible" ........Main file.............clear all;P = [3.59 0.00633966 0.088 0.068493151 0.010678]options = optimset('LargeScale','off');[PP, fval] = fmincon('mrbjlikepower',P,[],[],[],[],'confun',options);..........Constraints....................function [cin, ceq] = confun(P)cin = [-P(1) + 3 ; - P(2) ; P(2) - 5];ceq = [];I am just begginning to write programs in matlab so can't figure out what this means.Any suggestions on how to rectify this , would be very much appreciated .Thanks.MF
Last edited by MF01 on February 10th, 2007, 11:00 pm, edited 1 time in total.
 
User avatar
mikeoz
Posts: 1
Joined: September 28th, 2005, 2:58 pm

Matlab fmincon error message

February 9th, 2007, 2:20 pm

Well, for starters, you do not have enough input arguments. Try adding 2 more [] before 'confun' corresponding to LB & UB.
 
User avatar
Sonyah
Posts: 0
Joined: December 11th, 2006, 3:58 pm

Matlab fmincon error message

February 9th, 2007, 2:39 pm

The error message means that you are trying to assign an array/structure to a variable that expects a double - most likely somewhere in the argument list of one of your function calls. If you are using the wrong number of arguments as suggested by mikeoz then that could mean you are passing in an unexpected type somewhere.
 
User avatar
MF01
Topic Author
Posts: 0
Joined: August 5th, 2005, 8:13 am

Matlab fmincon error message

February 9th, 2007, 2:49 pm

Thanks mikeoz..I had realised I was not inputting sufficient place holders.Although the function runs ...I am getting wierd results for the parameters..long term mean of around 1000 ! I am now trying to sort this out .