Code covered by the BSD License
-
A=abm(f,T,Y)
-
D=qr1(A,epsilon)
Input - A is a symmetric tridiagona nxn matrix
-
D=qr2(A,epsilon)
Input - A is a symmetric tridiagonal nxn matrix
-
E=euler(f,a,b,ya,M)
-
F=findiff(p,q,r,a,b,alpha,bet...
-
H=hamming(f,T,Y)
-
H=heun(f,a,b,ya,M)
-
L=linsht(F1,F2,a,b,alpha,beta...
Input - F1 and F2 are the systems of first-order equations
-
L=ls(F1,F2,a,b,alpha,beta,M)
Input - F1 and F2 are the systems of first-order equations
-
M=milne(f,T,Y)
-
P=pcsfit(X,S)
-
R=rk4(f,a,b,ya,M)
-
R=rkf45(f,a,b,ya,M,tol)
-
S=csfit(X,Y,dx0,dxn)
-
T4=taylor(df,a,b,ya,M)
-
T=house (A)
Input - A is an nxn symmetric matrix
-
T=rctrap(f,a,b,n)
-
U=crnich(f,c1,c2,a,b,c,n,m)
-
U=dirich(f1,f2,f3,f4,a,b,h,to...
Input - f1,f2,f3,f4 are boundary functions input as strings
-
U=forwdif(f,c1,c2,a,b,c,n,m)
-
X=backsub(A,B)
Input - A is an n x n upper-triangular nonsingular matrix
-
X=gseid(A,B,P,delta, max1)
-
X=jacobi(A,B,P,delta, max1)
-
X=trisys (A,D,C,B)
Input - A is the sub diagonal of the coefficient matrix
-
Z=srule(f,a0,b0,tol0)
-
[A,B]=lsline(X,Y)
Input - X is the 1xn abscissa vector
-
[A,B]=tpcoeff(X,Y,M)
-
[A,df]=diffnew(X,Y)
-
[C,D]=newpoly(X,Y)
Input - X is a vector that contains a list of abscissas
-
[C,L]=lagran(X,Y)
Input - X is a vector that contains a list of abscissas
-
[C,X,Y]=cheby(fun,n,a,b)
Input - fun is the string function to be approximated
-
[D,err,relerr,n]=diffext(f,x,...
-
[L,n]=difflim(f,x,toler)
-
[P,iter,err]=newdim(F,JF,P,de...
Input-F is the system saved as the M-file F.m
-
[P0,y0,err,P]=grads(F,G,P0,ma...
-
[R,quad,err,h]=romber(f,a,b,n...
-
[S,E,G]=golden(f,a,b,delta,ep...
-
[SRmat,quad,err]=adapt(f,a,b,...
-
[T,Z]=rks4(F,a,b,Za, M)
-
[V,D]=jacobi1(A,epsilon)
-
[V0,y0,dV,dy]=nelder(F,V,min1...
-
[c,err,yc]=bisect(f,a,b,delta)
-
[c,err,yc]=regula(f,a,b,delta...
-
[lambda,V]=invpow(A,X,alpha,e...
-
[p,Q]=steff(f,df,p0,delta,eps...
-
[p,y,err]=muller(f,p0,p1,p2,d...
-
[p0,err,k,y]=newton(f,df,p0,d...
-
[p1,err,k,y]=secant(f,p0,p1,d...
-
approot (X,epsilon)
Input - f is object function saved as an M-file named f.m
-
finedif(f,g,a,b,c,n,m)
-
fixedpoint(g,p0,tol,max1)
-
fixpt(g,p0,tol,max1)
Input - g is the iteration function
-
g(x)
-
lspoly(X,Y,M)
-
lufact(A,B)
-
power(A,X,epsilon,max1)
NUMERICAL METHODS: MATLAB Programs
-
power1(A,X,epsilon,max1)
-
quad=gauss(f,a,b,A,W)
-
quadmin(f,a,b,delta,epsilon)
-
s=simprl(f,a,b,M)
-
s=traprl(f,a,b,M)
-
seidel(G,P,delta, max1)
-
sroot(a)
-
uptrbk(A,B)
-
z=tp(A,B,x,M)
-
readme.m
-
View all files
|
|
| power1(A,X,epsilon,max1) |
function [lambda,V]= power1(A,X,epsilon,max1)
%Input - A is an nxn matrix
% - X is the nx1 starting vector
% - epsilon is the tolerance
% - max1 is the maximum number of iterations
%Output - lambda is the dominant eigenvalue
% - V is the dominant eigenvector
%Initialize parameters
lambda=0;
cnt=0;
err=1;
state=1;
while ((cnt<=max1)&(state==1))
Y=A*X;
%Normalize Y
[m j]=max(abs(Y));
c1=m;
dc=abs(lambda-c1);
Y=(1/c1)*Y;
%Update X and lambda and check for convergence
dv=norm(X-Y);
err=max(dc,dv);
X=Y;
lambda=c1;
state=0;
if (err>epsilon)
state=1;
end
cnt=cnt+1;
end
V=X;
|
|
Contact us at files@mathworks.com