Graphics Programs Reference
In-Depth Information
% USAGE: [eVal,eVec] = invPower(A,s,maxIter,tol)
% maxIter = limit on number of iterations (default is 50).
% tol = error tolerance (default is 1.0e-6).
if nargin < 4; tol = 1.0e-6; end
if nargin < 3; maxIter = 50; end
n = size(A,1);
A=A-eye(n)*s; %FormA*=A-sI
A = LUdec(A); % Decompose A*
x = rand(n,1); % Seed eigenvecs. with random numbers
xMag=sqrt(dot(x,x));x=x/xMag;
%Normalizex
fori=1:maxIter
xOld = x; % Save current eigenvecs.
x = LUsol(A,x); % Solve A*x = xOld
xMag=sqrt(dot(x,x));x=x/xMag; %Normalizex
xSign = sign(dot(xOld,x)); % Detect sign change of x
x = x*xSign;
% Check for convergence
if sqrt(dot(xOld - x,xOld - x)) < tol
eVal=s+xSign/xMag;eVec=x;
return
end
end
error('Too many iterations')
EXAMPLE 9.4
The stress matrix describing the state of stress at apoint is
30
10
20
S
=
MPa
10 0
50
20
50
10
Determine the largest principalstress (the eigenvalueof S farthest from zero) by the
powermethod.
Solution First iteration:
1 00 T be the initial guess for the eigenvector. Then
Let v
=
=
30
10
20
1
0
0
30
.
0
z
=
Sv
=
10 0
50
10
.
0
20
50
10
20
.
0
Search WWH ::




Custom Search