WPINV - Compute weighted pseudoinverse. [G,F] = wpinv(A,W) Computes the optimal solution x = Gy + Fx0 to the least squares problem min ||W(x-x0)|| subj. to Ax = y x See also PINV.
0001 function [G,F] = wpinv(A,W) 0002 0003 % WPINV - Compute weighted pseudoinverse. 0004 % 0005 % [G,F] = wpinv(A,W) 0006 % 0007 % Computes the optimal solution x = Gy + Fx0 to the least squares 0008 % problem 0009 % 0010 % min ||W(x-x0)|| subj. to Ax = y 0011 % x 0012 % 0013 % See also PINV. 0014 0015 [m,n] = size(A); 0016 if nargin < 2 0017 W = eye(n); 0018 end 0019 0020 % Thesis, Lemma B.1 0021 G = inv(W)*pinv(A*inv(W)); 0022 F = eye(n) - G*A;