📄 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 + -