QR decomposition in matlab

Status
Not open for further replies.

varuniyengar

Advanced Member level 4
Joined
Jan 18, 2011
Messages
107
Helped
17
Reputation
34
Reaction score
17
Trophy points
1,298
Activity points
1,743
Can some one help me out in finding the QR decomposition of a Hermitian matrix


the code that i have written does not work well with complex

clc
clear all
close all

%A = [1 1 1; 1 1 0 ; 1 1 2];
A = [1+6j 1-4j 3-2j; 1+4j 8-1j 2+4j ; 3+2j 2-4j 2];
[qq rr] = qr(A);

[m n] = size(A);

r = zeros(n,n);mm=0;
QT = zeros(n,m);
Q = A;

for k=1:n
QT(k, = A,k)';
end
for k = 1:n
r(k,k) = sqrt(QT(k,*QT(k,');
QT(k, = QT(k,/r(k,k);
if(k<n)
for j=k+1:n
r(k,j)= (A,j)'*QT(k,')';
QT(j,= (QT(j,'-(r(k,j)*QT(k,'))';
end
end
end

thanks in adv
 

Why "not work well with complex" ?
The only detail is that your code calculates A = QT' * R instead of A = QT * R
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…