An error 'matlabexecutionerror' occurred when i use 'min' in type optim.prob​lemdef.Opt​imizationE​xpression

조회 수: 2 (최근 30일)
prob = optimproblem('ObjectiveSense','maximize');
A = optimvar('A', 2, 54, 41, 'Type', 'continuous', 'LowerBound', 0);
X = sum(squeeze(A(1,:,:)) .* M); % 1*41
Unrecognized function or variable 'M'.
Y = sum(squeeze(A(2,:,:)) .* N);
f = 0.5*min(X+X,X+C)*P'-sum(sum(squeeze(A(1,:,:)).*U)); % It raises an error here when I try to use min(X+X,X+C).
g = 0.5*min(Y+Y,D+Y)*Q'-sum(sum(squeeze(A(2,:,:)).*V));

답변 (1개)

Torsten
Torsten 2024년 9월 7일
편집: Torsten 2024년 9월 7일
"min" is not a supported operation for optimization variables:
You will have to use "fcn2optimexpr" instead:

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by