Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. tylko nie kopiuj tego ofem ...:P:P
  2. function [lam, V, it_lam]=lambdy(A, ep)
  3. wym=size(A);
  4. wym=wym(1, 2);
  5. y=ones(1, wym)';
  6. x=[1 zeros(1, wym-1)]';
  7. lam=zeros(1, wym);
  8. V=zeros(wym,wym);
  9. it_lam=zeros(1, wym);
  10.  
  11. for i=1:wym
  12. p=1;
  13. j=0;
  14. while (p>ep)
  15. j=j+1;
  16. a=A^(j+1)*x
  17. b=A^(j)*x
  18. V(:, i)=a
  19. V(:,i)=V(:, i)./max(V(:, i))
  20. lamtmp=a./b
  21. lam(i)=sum(lamtmp)/wym;
  22. if j==1;
  23. p=abs(0.5+lam(i));
  24. else
  25. p=abs(lamp-lam(i));
  26. end
  27. lamp=lam(i);
  28. end
  29. it_lam(i)=j;
  30.  
  31. Macierz=lam(i)*V(:, i)./(norm(V(:, i)))*V(:, i)'./(norm(V(:, i)));
  32. B=A-Macierz;
  33. A=B;
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement