필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Minimize an objective function

조회 수: 3 (최근 30일)
Gratitude Kim
Gratitude Kim 2017년 8월 4일
댓글: Gratitude Kim 2017년 8월 4일
Hi, I will like to ask for the objective function is there any other way to write instead of typing all the variables (X11 to X14) into the function. - f([X11 X12 X13 X14])
variables = {'X11','X12','X13','X14'};
N = length(variables);
display (N);
% create variables for indexing
for v = 1:N
eval([variables{v},' = ', num2str(v),';']);
end
% objective function
f = zeros(size(variables));
f([X11 X12 X13 X14 ])=[0.08,0.12,0.16,0.20];
Thanks
  댓글 수: 2
Walter Roberson
Walter Roberson 2017년 8월 4일
I am at a loss as to what your intended result is. If X11 X12 X13 X14 are not positive integers, then f([X11 X12 X13 X14 ])=[0.08,0.12,0.16,0.20] would be trying to index the array f at non-integer locations.
I do not see where "objective function" comes into this?
Gratitude Kim
Gratitude Kim 2017년 8월 4일
is okay. i have figured it out. sorry that my question was unclear. thanks

답변 (0개)

이 질문은 마감되었습니다.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by