Can you help me with this question please? For the code, please do it on MATLAB. Thanks
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
COMMENT DOWN FOR ANY QUERY RELATED TO THIS ANSWER,
IF YOU'RE SATISFIED, GIVE A THUMBS UP
Can you help me with this question please? For the code, please do it on MATLAB. Thanks
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, 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 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,...
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 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 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 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: 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 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 %%%...
hi can you sovle this problem and do the matlab code please. thanks Problem #1 From ECE 102 Engineering Computation textbook-, problem #1, page 126: Note: C is coulombs of charge, A is amperes of current The flow of charge in a conductor varies with time according to the function g(t)=(1-3,-)C a) Ifk -0.1s, find the current atl e Express your result rounded to 3 decimal places dt b) What is the current for very large values of time r?...