How can I re-write an anonymous function into a standard function?
Ältere Kommentare anzeigen
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 Kommentar
dpb
am 9 Nov. 2019
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
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Common Operations finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!