solving linear system with decomposition(A,’qr’) and qr(A) produce different results
load post.mat
x1 = decomposition(CA,’qr’)b_f;
[qq2,rr2,pp2] = qr(CA);
x2= pp2 * (rr2(qq2’*b_f));
[qq3,rr3,pp3] = qr(CA,"econ","vector");
x3(pp3,:) = rr3(qq3’*b_f);
any(x1-x2~=0)
any(x3-x2~=0)
I know that the CA matrix is ill-conditioned. But that doesn’t explain the difference in solution, right?
Also, solving the system using decomposition(CA,’lu’) and lu(CA) produce the same results. So why not the ‘qr’ pair?load post.mat
x1 = decomposition(CA,’qr’)b_f;
[qq2,rr2,pp2] = qr(CA);
x2= pp2 * (rr2(qq2’*b_f));
[qq3,rr3,pp3] = qr(CA,"econ","vector");
x3(pp3,:) = rr3(qq3’*b_f);
any(x1-x2~=0)
any(x3-x2~=0)
I know that the CA matrix is ill-conditioned. But that doesn’t explain the difference in solution, right?
Also, solving the system using decomposition(CA,’lu’) and lu(CA) produce the same results. So why not the ‘qr’ pair? load post.mat
x1 = decomposition(CA,’qr’)b_f;
[qq2,rr2,pp2] = qr(CA);
x2= pp2 * (rr2(qq2’*b_f));
[qq3,rr3,pp3] = qr(CA,"econ","vector");
x3(pp3,:) = rr3(qq3’*b_f);
any(x1-x2~=0)
any(x3-x2~=0)
I know that the CA matrix is ill-conditioned. But that doesn’t explain the difference in solution, right?
Also, solving the system using decomposition(CA,’lu’) and lu(CA) produce the same results. So why not the ‘qr’ pair? qr decomposition, linear algebra, linear system MATLAB Answers — New Questions