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
  • Can you please help me with this question. Much appreciated. So I have a sample code,...

    Can you please help me with this question. Much appreciated. So I have a sample code, but we need to change the code in a way that fits the problem. A planar slab of material is initially at a temperature of 300 K. At the time t=0, microwave radiation is directed at the material, leading to internal heat generation that is uniform within the material. The sides of the slab experience negligible heat losses and a water bath maintains the...

  • on matlab (1) Matrices are entered row-wise. Row commas. Enter 1 2 3 (2) Element A,...

    on matlab (1) Matrices are entered row-wise. Row commas. Enter 1 2 3 (2) Element A, of matrix A is accesser (3) Correcting an entry is easy to (4) Any submatrix of Ais obtained by d row wise. Rows are separated by semicolons and columns are separated by spaces ner A l 23:45 6. B and hit the return/enter kry matrix A is accessed as A Enter and hit the returnerter key an entry is easy through indesine Enter 19...

  • 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,...

  • Can somebody help me with my matlab code? I am plotting the POWER SPECTRAL DENSITY OF...

    Can somebody help me with my matlab code? I am plotting the POWER SPECTRAL DENSITY OF Manchester, Polar, UNIPOLAR, and BIPOLAR. It wont run. The error I am getting is "incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To perform element wise multiplication, use '.*'. " clc; clear all; %Declaration of variables bandwidth = 1; total_bandwidth = 1/bandwidth; f = 0:.05*bandwidth:2*total_bandwidth; x=f*total_bandwidth; %Manchester Power...

  • PLEASE USE MATLAB. The code is basically given to you with the algorithm above. Write a...

    PLEASE USE MATLAB. The code is basically given to you with the algorithm above. Write a program for solving the system Ar-b by using Gauss-Seidel iterative method discussed in class that uses a computer memory for one iterate only. This could be summarized as follows: Input n -- the size of the system, matrix A-(a(i,j), the vectoir b (b (1), . . . , b(n)), the intitial guess x (x(1), ..., x(n)) (you can use x=b) maximum number of iterations...

  • For MATLAB users. Can you please type the answers for the MATLAB sections. Consider the RLC circuit where R - 5, C- 1, L- 4 and Vs - 8 1. Use circuit analysis laws to show that the resistor's vol...

    For MATLAB users. Can you please type the answers for the MATLAB sections. Consider the RLC circuit where R - 5, C- 1, L- 4 and Vs - 8 1. Use circuit analysis laws to show that the resistor's voltage and induc- tor's voltage can be modelled as the system of ODEs Vi VL RC 2. Solve the eigenvalues and eigenvectors of the coefficient matrix in the system of ODEs. 3. Verify your answer for question (2) by using the...

  • Please help to solve that question very appreciate if you can help me to solve all the part...

    please help to solve that question very appreciate if you can help me to solve all the part as my due date coming soon but got stuck in this question. Consider two separate linear regression models and For concreteness, assume that the vector yi contains observations on the wealth ofn randomly selected individuals in Australia and y2 contains observations on the wealth of n randomly selected individuals in New Zealand. The matrix Xi contains n observations on ki explanatory variables...

  • the last pic is number 14 please answer it as a,b,c,d as well. thanks 1. If...

    the last pic is number 14 please answer it as a,b,c,d as well. thanks 1. If A is diagonalizable then A is diagonalizable. a) True b) The statement is incomplete c) False d) None of the above 2. In every vector space the vector (-1)u is equal to? a) -U b) All of the above c) None of the above d) u 3. The set of vectors {} is linearly dependent for a) k = 3 b) k = 1...

  • Can someone please help me with this, I'm really stuck. here a sample code provide for the matlab...

    can someone please help me with this, I'm really stuck. here a sample code provide for the matlab: clear all; close all; % ---------- (a) ---------- a = 0.7; % attenuation coef. D = 5; % digital time delay UnitImpulse = [1 zeros(1,???)]; % creat unit impulse, starting from n=0; x = UnitImpulse; y = filter(1, [1 zeros(1, D-1) -a], x); % help filter, do you know the usage of filter() now? n = 0:(length(y)-1); % check length of y[n]...

  • I have all of the answers to this can someone just actually explain this matlab code and the results to me so i can get a better understanding? b) (c) and (d) %% Matlab code %% clc; close all; clear...

    I have all of the answers to this can someone just actually explain this matlab code and the results to me so i can get a better understanding? b) (c) and (d) %% Matlab code %% clc; close all; clear all; format long; f=@(t,y)y*(1-y); y(1)=0.01; %%%% Exact solution [t1 y1]=ode45(f,[0 9],y(1)); figure; plot(t1,y1,'*'); hold on % Eular therom M=[32 64 128]; T=9; fprintf(' M Max error \n' ); for n=1:length(M) k=T/M(n); t=0:k:T; for h=1:length(t)-1 y(h+1)=y(h)+k*f(t(h),y(h)); end plot(t,y); hold on %%%...

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