MATLAB Answers

0

Optimization Problem about Optimal Portfolio with Aversion Index

KA HEI LAM さんによって質問されました 2019 年 2 月 4 日
最新アクティビティ Alan Weiss
さんによって コメントされました 2019 年 2 月 4 日
Hello everyone, I'm trying to due with following optimization problem:
Screen Shot 2019-02-04 at 15.46.34.png
I have done some of the coding but cannot finish the double summation part.
Screen Shot 2019-02-04 at 15.48.14.png
Does anyone have any ideas that could help??? Thanks in advance.

  0 件のコメント

サインイン to comment.

1 件の回答

回答者: Alan Weiss
2019 年 2 月 4 日

I don't see your rho and sigma variables, but you could try
sumexpr = optimexpr;
for i = 1:n
for j = 1:n
sumexpr = sumexpr + w(i)*w(j)*rho(i,j)*sigma(i)*sigma(j);
end
end
It would undoubtedly be more efficient to write this double summation as a standard MATLAB matrix multiplication, something like
sumexpr = w'*M*w;
where M has an appripriate definition, but the double sum should work, too.
Alan Weiss
MATLAB mathematical toolbox documentation

  2 件のコメント

KA HEI LAM 2019 年 2 月 4 日
Thanks for the reply. I tried the following double summation:
w'*ann_std'*corrlation*ann_std*w
but there is an error:
Error using optim.internal.problemdef.MatrixOperator
Inner matrix dimensions must agree.
Error in optim.internal.problemdef.Mtimes
Error in *
I have calculated the rho and sigma with n-by-n and 1-by-n matrix respectively. Is there any problem?
Alan Weiss
2019 年 2 月 4 日
I suggest that you use the debugger to find out what sizes the variables have just before the times operation executes.
Alan Weiss
MATLAB mathematical toolbox documentation

サインイン to comment.



Translated by