matlab coding for simple subspace iteration

조회 수: 6 (최근 30일)
Boyka
Boyka 2014년 5월 3일
편집: Geoff Hayes 2014년 5월 3일
I wrote the code for the simple subspace iteration but it does not seem to work properly. Here is my code
function [v,lamda] = SSI(A,tol)
n=size(A,1);
v=rand(n);
res=1;
while (res > tol)
W = A*v;
[Q,R] = qr(W);
v = Q;
res = norm(W-A*v);
end
and the algorithm is as follows
Choose an initial system of vectors v_{0}
Iterate: Until convergence do,
v_{k} = Av_{k-1}
v_{k} = QR the QR factorisation of v_{k} and set v_{k} = Q
Thanks in advance
  댓글 수: 1
Geoff Hayes
Geoff Hayes 2014년 5월 3일
편집: Geoff Hayes 2014년 5월 3일
Please clarify what is meant by "…does not seem to work properly". What exactly doesn't work properly in your algorithm? Is the error something like "not all output parameters are set"? The output parameter lambda is not being set to anything so that could be a problem. Else this code looks awfully similar to ssi problem.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by