用于最小化向量的 MATLAB 代码

MATLAB code for Minimization of vectors

问题:我应该使用MatLab中什么类型的优化函数来解决以下最小化矩阵问题?

我正在尝试找到行向量 V,使得 [[ (f – transpose(V) * R) ]] 最小化受制于:

转置(V)*B = 0.

++++变量:

+++++更多条件:

谢谢, 马特

你应该使用 fmincon:

% random inputs f, R, B
f = rand;
R = 2*rand(8,1) - 1;
B = 2*rand(8,1) - 1;
% minimization term
fun = @(V) abs(f - V'*R);
% constrains: transpose(V)*B = 0 and sum(V) = 1
Aeq = [B';ones(1,8)];
beq = [0;1];
% lower (0) and upper (1) bounds
lb = zeros(8,1);
ub = ones(8,1);
% initial guess
V0 = rand(8,1);V0 = V0/sum(V0);
% constrained minimization
V = fmincon(fun,V0,[],[],Aeq,beq,lb,ub);
% check result
sum(V) % should be 1
V'*B % sould be 0
[min(V) max(V)] % should be between 0 to 1