Objective function in a for loop
조회 수: 1 (최근 30일)
이전 댓글 표시
hi all,
I have an objective function that I want to minimize
N=10
f=@(x) ((0.0011*(x(2:1*N)-x(1:N-1)))'*exp(-0.0078*x(4*N+1:4*N+N-1)))*3/20
is it possible to create a for loop so that the function changes for each i, like this?:
for i=2:10
f=@(x) ((0.0011*(x(i):1*N)-x((i-1):N-1)))'*exp(-0.0078*x(4*N+1:4*N+N-1)))*3/20
end
thanks
Nikolas
댓글 수: 0
답변 (1개)
Torsten
2018년 10월 25일
No, because the number of elements of ((0.0011*(x(i):1*N)-x((i-1):N-1))) must always be N-1.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Quadratic Programming and Cone Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!