How can I re-write an anonymous function into a standard function?
이전 댓글 표시
I'm new to matlab. I would like to rewrite the following anonymous function into a standard function but I got struggled with the syntax.
Original function:
objc = @(w) [-mu'*w' w*C*w'];
My adjustment:
function [returns,variance] = MultiObjective(mu,C)
returns = -1*mu'*w';
variance = w*C*w';
end
댓글 수: 1
dpb
2019년 11월 9일
The anonymous function has only w as the parameter; mu, C are embedded into the function definition with the values they contain at the time the function is defined.
Your function, would also have to pass w
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Common Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!