How can I write a self scaling function for fmincon ?
이전 댓글 표시
Hey,
I use fmincon and I want to maximize this function =
fun = @(x) -(x(1)*x(2)*x(3))
and now I do not want to change this function everytime I in- or decrease the size of my optimization.
For example:
If I am looking for 6 solutions my function should look like this =
fun = @(x) -(x(1)*x(2)*x(3)*x(4)*x(5)*x(6))
Is there a way to do it automatically ?
Thank you so much!
채택된 답변
추가 답변 (1개)
Walter Roberson
2018년 11월 28일
1 개 추천
@(X) -prod(X)
카테고리
도움말 센터 및 File Exchange에서 Set Optimization Options에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!