New Microsoft Word Document (2)

New Microsoft Word Document (2) - Q=Q*Qk; end 10.3 (1) by...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
10. 2(a) function [W,R]=house(A) [m,n]=size(A); Q=eye(m); for k=1:n x=A(k:m,k); vk=x; vk(1)=sign(x(1))*norm(x)+x(1); vk=vk/norm(vk); A(k:m,k:n)=A(k:m,k:n)-2*vk*(vk'*A(k:m,k:n)); W{k}=vk; end R=A(1:n,1:n); 10. 2(b) function Q=formQ(W) [m,n]=size(W{1}); Q=eye(m); for k=1:n Hk=eye(m-k+1)-2*W{k}*(W{k}'); Qk=[eye(k-1) zeros(k-1,m-k+1); zeros(m-k+1,k-1) Hk];
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Q=Q*Qk; end 10.3 (1) by mgs: Z=[1 2 3;4 5 6;7 8 7;4 2 3;4 2 2]; [Q,R]=mgs(Z) Q = 0.1010 0.3162 0.5420 0.4041 0.3534 0.5162 0.7071 0.3906 -0.5248 0.4041 -0.5580 0.3871 0.4041 -0.5580 -0.1204 Orthonormal R = 9.8995 9.4954 9.6975 0 3.2919 3.0129 0 0 1.9701...
View Full Document

Ask a homework question - tutors are online