updating my matlab code for Arnoldi iteration

10 vues (au cours des 30 derniers jours)
Boyka
Boyka le 11 Mai 2014
Commenté : Jan le 11 Mai 2014
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
  2 commentaires
Jan
Jan le 11 Mai 2014
What is your question? Do you want us to solve your job?

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by