this is the code I have : function [q,r] = qrgivens(A) format…
Question this is the code I have : function [q,r] = qrgivens(A) format… Image transcription textAn explanation of the method la below: ht our code for Exercise 2 of Project 1, we, ?rst, initialized rr=a: and,then, we calculated a rotation matrix It; and used it in tire recurrence formula for R: nus – *R: Suppose that weaniyed at an upper triangular matrix R after p rotations. If we denote a rotation matrix as 13,13 = 1:… Show more… Show morethis is the code I have :function [q,r] = qrgivens(A)format[m,n]=size(A);r=A;q=eye(m);k=min(m,n);for j=1:k while j < m if r(m-1,j) ~= 0 break else b = r(m-1,j); a = r(j,j); G = givensrot(m,m-1,j,a,b); q=q*G; r = G' * r; end r = G' * r; m=m-1; endend% Display output of rotated matrixdisp('The output of the matrix r is');disp(q);disp(r);% Test validity of rotated matrixtest = true;if closetozeroroundoff(r-triu(r),7) ~= r disp('r is not upper-triangular?!');else test = false;endif closetozeroroundoff(q'*q-eye(m),7) ~= zeros(m) disp('q is not orthogonal?!');else test = false;endif A == q*r disp('QR factorization is not working?!')else test = false;endif test == false r=[]; q=[];end there's errors in my code, its not factorizing correctly Math Statistics and Probability matlab MAS 3114 Share QuestionEmailCopy link Comments (0)


