Question

Implement the following simple version of QR iteration with shifts for computing the eigenvalues of a general real matrix A R

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

MATLAB Script:

close all
clear
clc

A = [6 2 1; 2 3 1; 1 1 1];
l = find_eig_vals(A);
fprintf('EigenValue: %f\n', l)

function out = find_eig_vals(A)
n = size(A,1);
tol = 1e-12; % tolerance
sigma = Inf;
for i = 1:10
sigma_prev = sigma;
sigma = A(n,n);
if abs(sigma - sigma_prev) < tol % convergence criteria
break
else
[Q,R] = qr(A - sigma*eye(n));
A = R*Q + sigma*eye(n);
end
end
out = sigma;
end

Output:

EigenValue: 0.578933

Add a comment
Know the answer?
Add Answer to:
Implement the following simple version of QR iteration with shifts for computing the eigenvalues of a...
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
  • In this exercise, you will work with a QR factorization of an mxn matrix. We will proceed in the ...

    In this exercise, you will work with a QR factorization of an mxn matrix. We will proceed in the way that is chosen by MATLAB, which is different from the textbook presentation. An mxn matrix A can be presented as a product of a unitary (or orthogonal) mxm matrix Q and an upper-triangular m × n matrix R, that is, A = Q * R . Theory: a square mxm matrix Q is called unitary (or orthogona) if -,or equivalently,...

  • code in matlab 1. [2+1+1pt] Power Method and Inverse Iteration. (a) Implement the Power Method. Use...

    code in matlab 1. [2+1+1pt] Power Method and Inverse Iteration. (a) Implement the Power Method. Use your code to find an eigenvector of -2 1 4 A= 1 1 2 4 1 -2 starting with Xo = (1, 2, -1)7 and Xo = (1, 2, 1)7. Report the first 5 iterates for each of the two initial vectors. Then use MATLAB's eig(A) to examine the eigenvalues and eigenvectors of A. Where do the sequences converge to? Why do the limits...

  • 4) This exercise will first present the modified algorithm for computing the product of two numbers...

    4) This exercise will first present the modified algorithm for computing the product of two numbers represented in twos complement with an illustrated example and then ask you to repeat for a different number pair The hardware and the flowchart for signed multiplication in twos complement representation of binary numbers will be slightly modified as follows. Use the version of the unsigned multiplication hardware which employs one double-sized register to hold the partial product and the multiplier a. When shifting...

  • Design and implement a C version of the color match program. As a starting point, use...

    Design and implement a C version of the color match program. As a starting point, use the file HW2-1-shell.c. The program should employ a reasonable algorithm that compares all pairings of colors in the palette exactly once. A color should not be compared to itself. Nor should two colors be compared to each other more than once. Your C program should print out the total component color difference for the closest pair using the print string provided in the shell...

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