updating my matlab code for Arnoldi iteration

9 Ansichten (letzte 30 Tage)
Boyka
Boyka am 11 Mai 2014
Kommentiert: Jan am 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

Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by