?? itermult.m
字號:
function [u,lambda] = iterMult(A,x,nit)
% iterMult Iterated multiplication of a vector by a matrix: u = A*A*...*A*x
%
% Synopsis: u = iterMult(A,x,nit)
% [u,lambda] = iterMult(A,x,nit)
%
% Input: A = an n by n matrix
% x0 = n by 1 (column) vector to start the iterations
% nit = number of iterations
%
% Output: u = A*A* ... A*x, result of m multiplications of A on x
% scaled by the max norm of the result at each step
% The max norm of u is printed at each step
% lambda = (optional) infinity norm of the scaled u
u = x;
fprintf(' k norm(u,inf)\n');
for k=1:nit
u = A*u;
r = norm(u,inf);
u = u/r;
fprintf('%3d %f\n',k,r);
end
if nargout==2, lambda = r; end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -