Error on minimizing matrix through fmincon and quadprog :(

3 views (last 30 days)
I'm currently in the process of minimizing a skewness coskewness matrix to find the optimal weight of an asset class.
With fmincon i get the error; User supplied objective function must return a scalar value.
With quadprog i get the error; The Hessian must have the same number of rows and columns
I've got 8 asset classes, so when minimizing the var/covar matrix i had no issue through the fmincon/quadprog function since its 8x8 matrix.
However, the skewness coskewness matrix is 8 * 64 matrix My data matrix is 145*8 matrix (where i put my returns).
Data = is a 145*8 matrix
skew_coskew = 8 * 64 matrix
A = ones(1,8)
S = cov(Data)*12
%initial weights
x0=zeros(1,size(Data,2))';
%optimization settings algorithmn
Aeq=ones(1,8)
beq=1;
optimopt = optimset('fmincon');
optimopt = optimset('algorithm','interior-point')
optimopt.MaxIter=500000;
optimopt.MaxFunEvals=50000;
%minimizing through fmincon
%[weights,fval,exitflag] = fmincon(@(X) skew_coskew*-1,x0,[],[],Aeq,beq,zeros(8,1),ones(8,1),[],optimopt);
%minimizing through quadprog
[weights,fval,exitflag,output]=quadprog(skew_coskew*-1,zeros(8,1),[],[],Aeq,beq,zeros(8,1),ones(8,1),[]);
The question I have, is there any way to find an optimal maximum for my weights vector of this skew-coskewness matrix? It seems to me I can't use these functions since my skewn coskew matrix will ofc. always have other dimensions.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!