updating my matlab code for Arnoldi iteration
Afficher commentaires plus anciens
Actually this code is going to break the matrix into 2 parts, the orthogonal basis "Q" and the a Hessenberg matrix "H". The remaining job is to take part of the hessenberg matrix "H" (to neglect the last row of zero),and apply a simple function in matlab on the matrix "H" to calculate its eigenvalue. Eg lamda=eig(H)
Here is my coding
function[Q,H]=Arnoldi(A,k,b)
m=length(b);
H=zeros(k);
Q=zeros(m,k);
Q(:,1)=b/norm(b);
for n=1:k
v=A*Q(:,n);
for j=1:n
H(j,n)=Q(:,j)'*v;
v=v-H(j,n)*Q(:,j);
end
H(n+1,n)=norm(v);
Q(:,n+1)=v/H(n+1,n);
end
Thanks in advance
Réponses (0)
Catégories
En savoir plus sur MATLAB dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!