从受制于局部目标向量约束的矩阵中选择最佳列向量

时间:2016-01-26 15:44:11

标签: matlab matrix vector linear-algebra minimization

如何自动选择矩阵的列向量,其中元素子集中的标量值最接近同一子集的预定义目标向量中的标量值?

1 个答案:

答案 0 :(得分:0)

我在100,10矩阵上解决了问题和测试方法,它可以工作 - 也适用于更大的矩阵,同时希望不会变得太昂贵

%% Selection of optimal source function 
% Now need to select the best source function in the data matrix 
% k = 1,2,...n within which scalar values of a random set of elements are 
% closest to a pre-defined goal vector with the same random set  
% Proposed Method: 
% Project the columns of the data matrix onto the goal vector
% Calculate the projection error vector matrix; the null space of the
% local goal vector, is orthogonal to its row space  
% The column holding the minimum error vector is the optimal column 
% [1] find the null space of the goal vector, containing the projection
% errors 
mpg = pinv(gloc);
xstar = mpg*A; 
p = gloc*xstar;
nA = A-p;
% [2] the minimum error vector will correspond to the optimal source
% function
normnA = zeros(1,n);
    for i = 1:n
        normnA(i) = norm(nA(:,i));
    end
minnA = min(normnA);
[row,k] = find(normnA == minnA);
disp('The optimal source function is: ')
disp(k)