Because my posts here are basically written to their own memories, so the principle of the formula is not written out, want to know the students can go to see the linear algebra of NetEase public class about projection and orthogonal matrix that episodes
I give the MATLAB code here, if you have a topic to do, directly input the corresponding matrix into the line
function [xnew, Projection_matrix] =Projectin (Xold, xbasis)%Xold is the column vector to be projected%Xbasis is a set of bases for projection space%Projection_matrix is the projection matrix obtained%xnew is the orthogonal vector that is obtained, that is, a vector orthogonal to the projection space.%Given a set of vectors[A1,a2,a3]=M=[1,1,1;1,2,3;1,4,9]m can be put into MATLAB code, the first is written to express%to orthogonal A1 A2 A3, then the A1 as a base, a2 as a projection vector input, and then the orthogonal A1 A2 as the projection space, A3 as a projection vector input to get the following matrix%M=[1,1,1;1,0,-1;1/3,-2/3;1/3]; Projection_matrix=(xbasis)/(xbasis'*xbasis) *xbasis'; Xnew=Xold-Projection_matrix*Xold;End
The realization of projection matrix and orthogonal vector