Question

Develop a function qr solve that solves an n × n system using the MATLAB reduced QR decomposition, if the matrix is singular,

Develop a function QR deceomposition using MATLAB and solve this system

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution:-

I have written the required code below:-

A = [1 -1 0; 2 4 5; -7 1 3];

B = [1 -1 8]';

% Solving required matrices

[x1, resi1] = qr_decomp(A, B);

C = [21 3 -4 8; 1 3 59 0; 1 2 -22 35; 3 78 100 3];

D = [1 -1 1 2]';

[x2, resi2] = qr_decomp(C, D);

% Printing results

x1

resi1

x2

resi2

% Function to calculate QR decomposition and residual

function [X, resi] = qr_decomp(A, B)

[Q, R] = qr(A);

X = inv(R)*(Q')*B;

resi = (A*X - B).^2;

end

1 A-[1-1 0; 2 4 5; -7 1 3]; % solving required matrices 4[x1, resi1]-qr_decomp (A, B); 1.00 5 6 C-[21 3 -4 8; 1 3 59 0; 1 2 -

I hope it solves your problem and if you have any doubt please ask in the comments and if you liked the solution please upvote. Thanks.

Add a comment
Know the answer?
Add Answer to:
Develop a function QR deceomposition using MATLAB and solve this system Develop a function qr solve that solves an n ×...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT