Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clear all; clc;
- y=[2.7 ; 0.1 ; 4.5];
- A=[-0.8 0.3 1 0.4 ;
- -0.2 0.4 -0.3 -0.4;
- 0.2 1 -0.1 0.8];
- si=size(A);
- s=si(2);
- s2=si(1);
- B=zeros(1,s);
- for k=1:s
- An(:,k)=A(:,k)/norm(A(:,k));
- end
- for j=1:s
- w=(An'*y);
- [M, I] = max(abs(w));
- M=w(I);
- Anew(:,j)=A(:,I);
- lambda = pinv(Anew)*y;
- r=y-Anew*lambda;
- temp=ones(1,s2);
- temp=0.000001*temp;
- if B(1,I)==0
- B(1,I)=I;
- else B(1,I+1)=I+1;
- end
- if r<temp
- break;
- else
- A(:,I)=[];
- end
- end
- xrec=zeros(s,1);
- for h=1:length(B)
- xrec(B(h))=lambda(B(h));
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement