MATH304_HW04_20080373

# MATH304_HW04_20080373 - hw04 Math304_Numerical Methods HW#4...

This preview shows pages 1–3. Sign up to view the full content.

Math304_Numerical Methods HW#4 Due:26.03.2010 Seçkin Fidan 20080373 hw04 Page 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Page 2
function [eigval,eigvec] = power_iter(A,qo) % Call : [lambda,v] = power_iter(A) or % [lambda,v] = power_iter(A,qo) - qo is the initial vector % % Task : Computes an eigenvalue and an associated % eigenvector of A using power iteration. [m,n] = size(A); error('A must be square') if m ~= n end if nargin < 2 qo = randn(n,1); end epsln = 10^-15; iter = 1; fprintf('The estimate of the eigenvalue at each iteration\n'); fprintf('------------------------------------------------\n'); qo = qo/norm(qo); q = A*qo; qold = qo; fprintf('iter %02.2d : %1.15f\n', iter, q'*A*q); while iter == 1 | (norm(q-qold) > epsln) qold = q; q = q/norm(q); iter = iter+1; q = A*qold; end eigvec = q; eigval = q'*A*q; return (a) >> B1 = [ 1 0 1; 0 -0.8 0; 1 0 1] B1 = 1.0000 0 1.0000 0 -0.8000 0 1.0000 0 1.0000 >> [a,b] = power_iter(B1) The estimate of the eigenvalue at each iteration
This is the end of the preview. Sign up to access the rest of the document.
• Spring '11
• somalwar
• Power, Eigenvalue, eigenvector and eigenspace, British B class submarine, B type proanthocyanidin, Eigenvalue algorithm, qo, Math304_Numerical Methods HW

{[ snackBarMessage ]}

### Page1 / 3

MATH304_HW04_20080373 - hw04 Math304_Numerical Methods HW#4...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online