MATH304_HW03_20080373_v3

# MATH304_HW03_20080373_v3 - Math304 HW#3 Due:19.03.2010...

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

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

View Full Document

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

View Full Document

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Math304 HW#3 Due:19.03.2010 Seçkin Fidan 20080373 hw03 math304 Page 1 math304 Page 2 math304 Page 3 math304 Page 4 math304 Page 5 function [Q,R] = qrfactor(A) % call : [Q,R] = qrfactor(A) % Decompose the given matrix % A into Q and R using householder vectors % stored in U. Note that A = QR % A*R' = Q [n,m] = size(A); Ain = A; for k = 1:n-1 V = A(k:n,k); U = V - norm(V)*eye(n+1-k,1); U = U/norm(U); A(k:n,k:n) = A(k:n,k:n) - 2*U*(U'*A(k:n,k:n)); end R = A; Q = Ain * (R^-1); return function [Q,R] = qrfactor2(A) % call : [Q,R] = qrfactor2(A) % Decompose the given matrix % A into Q and R using householder vectors % stored in U. Note that Q = Q1*Q2*...*Qn. % [n,m] = size(A); Q = eye(n); for k = 1:n-1 Qt = eye(n); V = A(k:n,k); U = V - norm(V)*eye(n+1-k,1); U = U/norm(U); A(k:n,k:n) = A(k:n,k:n) - 2*U*(U'*A(k:n,k:n)); Qt(k:n,k:n) = constructq(U); Q = Qt*Q; end R = A; Q = Q'; return >> A = randn(3) A = 1.1908 -0.1567 -1.0565-1.2025 -1.6041 1.4151-0.0198 0.2573 -0.8051 >> [Q,R]= qrfactor(A) Q =...
View Full Document

{[ snackBarMessage ]}

### Page1 / 7

MATH304_HW03_20080373_v3 - Math304 HW#3 Due:19.03.2010...

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

View Full Document
Ask a homework question - tutors are online