how to compute orthonormal vectors via Lanczos process?

4 views (last 30 days)
Hello,
How to initialize vector in Matlab? could you please check what I did ( I want to start with V_0=0 , beta (0)=0 , V(:,1) = V/norm(V,2))
Also, how can we creat a matrix collect all V's we have found ? ( i.e Q=[ V_1 V_2 ... V_j+1] )
My code:
function [] = lanczos(A, m)
[n,k] = size(A);
V(:,0)=0;
V(:,1) = ones(k,1);
V(:,1)=V(:,1)/norm(V(:,1),2);
beta(0)=0;
for j=1:m
w = A*V(:,j) - V(:,j-1)*beta(j-1);
alpha(j-1) = V(:,j)'.* w;
w = w - V(:,j)* alpha(j-1);
beta(j) = norm(w,2);
V(:,j+1) = w/beta(j);
end

Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!