Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tylko nie kopiuj tego ofem ...:P:P
- function [lam, V, it_lam]=lambdy(A, ep)
- wym=size(A);
- wym=wym(1, 2);
- y=ones(1, wym)';
- x=[1 zeros(1, wym-1)]';
- lam=zeros(1, wym);
- V=zeros(wym,wym);
- it_lam=zeros(1, wym);
- for i=1:wym
- p=1;
- j=0;
- while (p>ep)
- j=j+1;
- a=A^(j+1)*x
- b=A^(j)*x
- V(:, i)=a
- V(:,i)=V(:, i)./max(V(:, i))
- lamtmp=a./b
- lam(i)=sum(lamtmp)/wym;
- if j==1;
- p=abs(0.5+lam(i));
- else
- p=abs(lamp-lam(i));
- end
- lamp=lam(i);
- end
- it_lam(i)=j;
- Macierz=lam(i)*V(:, i)./(norm(V(:, i)))*V(:, i)'./(norm(V(:, i)));
- B=A-Macierz;
- A=B;
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement