recursive orthogonalization of basis functions FORMAT bf = pr_spm_orth(bf) From spm_get_bf.m, see that file for credits $Id$
0001 function bf = pr_spm_orth(BF) 0002 % recursive orthogonalization of basis functions 0003 % FORMAT bf = pr_spm_orth(bf) 0004 % 0005 % From spm_get_bf.m, see that file for credits 0006 % 0007 % $Id$ 0008 0009 if nargin < 1 0010 error('Need BF'); 0011 end 0012 0013 bf = BF(:,1); 0014 bf = bf/sqrt(mean(bf.^2)); 0015 for i = 2:size(BF,2) 0016 D = BF(:,i); 0017 D = D - bf*(pinv(bf)*D); 0018 if any(D) 0019 bf = [bf D/sqrt(mean(D.^2))]; 0020 end 0021 end 0022 0023