Question

7. Bonus [3+3+4pts] Before answering this question, read the Google page rank article on Pi- azza in the General Resources

Can you help me with this question please? For the code, please do it on MATLAB. Thanks

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


clc
clear
close all

n = 100; % any integer >=100

I = eye(n);
A = 0.5*I(randperm(n),:)+(max(2,randn(n,n))-2);
A = A - diag(diag(A));
L = A*diag(1./(max(1e-10,sum(A,1))));


spy(L)
title('sparsity structure of L')


% computing eigen values of L
eigValuesOfL = eig(L)
realPartEigValuesOfL = real(eigValuesOfL);
imagPartEigValuesOfL = imag(eigValuesOfL);

%plotting imag vs real
figure
plot(realPartEigValuesOfL,imagPartEigValuesOfL,'*')

%computing and plotting the unit circle centered at (0,0)
x = linspace(-1,1,100);
yUpper = sqrt(1-x.^2); % x^2+y^2=1
yLower = -yUpper;
hold on
plot(x,yUpper,'-r')
hold on
plot(x,yLower,'-r')
axis equal
xlabel('real part of eigne values of L')
ylabel('immaginary part of eigne values of L')
title('Eigen values of L')

% matrix E of all values = 1/n
E = ones(n,n).*1/n;

% let k start at 0.1 increase by 0.1 upto 3
K = 0.1:0.1:3;
for i=1:numel(K)
k = K(i);
S = k*L + (1-k)*E;
eigValuesOfS = eig(S);

% we can determine the rate of convergence by comparing the ratio of the
% first to second largest eigen value for each value k

% for purposes of computing the cpnvergence rate
sizeOfEachEignValue = abs(eigValuesOfS);
sortedEig = sort(sizeOfEachEignValue);

% ratio of largest to second largest eignen value
ratio(i) = sortedEig(end)/sortedEig(end-1);
end

figure
plot(K,ratio,'linewidth',2)
xlabel('k')
ylabel('rate of convergence')
grid on


% the rate of convergence is seen to exponentially decrease as k tends to 1
% and remains almost constant and low after k=1 so values of k<1 will increase the
% speed of convergence of the power method

sparsity structure of L 10 20 50 60 70 80 100 20 40 60 80 100 nz = 304

Eigen values of L 0.8 0.6 0.4 0.2 米米米米 米米 米米 米米 兼米 米米 米米米米 米米米米 米米 0.2 2 米 米 米米 米米 米米米米 0.6 -0.8 0.5 0.5 real part of eigne v

2 0 8 6 4 0 aoue DJaAU00 jo ale」

COMMENT DOWN FOR ANY QUERY RELATED TO THIS ANSWER,

IF YOU'RE SATISFIED, GIVE A THUMBS UP

Add a comment
Know the answer?
Add Answer to:
Can you help me with this question please? For the code, please do it on MATLAB. Thanks
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