Orthogonal matching pursuit

来源:互联网 发布:知错改错善莫大焉 编辑:程序博客网 时间:2024/06/04 19:52

帮别人做的问题:


自己写的程序:

% --------- The input ---------------D = zeros(10, 10);for ii=1:10,    for jj=1:10,        D(ii, jj) = sin(ii+jj);    endendA = D + eye(10);b = [-2 -6 -9 1 8 10 1 -9 -4 -3]';S = 3;% -----------------------------------normA = normc(A);residual = b;len = size(A, 2);index = zeros(len, 1);for ii = 1:S,    % Compute the inner product    proj = normA'*residual;        %find the max value and its index    [~, pos] = max(abs(proj));        % store the index    index(ii) = pos(1);        %solve the least squares problem    a = pinv(A(:,index(1:ii)))*b;        % compute the residual in the new dictionary    residual = b-A(:, index(1:ii))*a;endx = zeros(length(b), 1);x(index(1:ii)) = a;% ------- the result ---------norm(A*x-b)norm(x)


参考:

【1】MP算法和OMP算法及其思想 http://blog.csdn.net/scucj/article/details/7467955

1 0