function [lambda,V]= power(A,X,epsilon,max1)
% NUMERICAL METHODS: MATLAB Programs
%(c) 1999 by John H. Mathews and Kurtis D. Fink
%To accompany the textbook:
%NUMERICAL METHODS Using MATLAB,
%by John H. Mathews and Kurtis D. Fink
%ISBN 0-13-270042-5, (c) 1999
%PRENTICE HALL, INC.
%Upper Saddle River, NJ 07458
lambda=0;cnt=0;err=1;iterating=1;state=iterating;
while ((cnt<=max1)&(state==iterating))
Y=A*X;
[m j]=max(abs(Y));
c1=Y(j);
cnt=cnt+1;
end
V=Y;