PLEASE SOLVE by USING MATLAB 1. In this question, we will utilize proposition 7.
ID: 3698982 • Letter: P
Question
PLEASE SOLVE by USING MATLAB
1. In this question, we will utilize proposition 7. to investigate linear algebra techniques applied to efficiency in code. Input the following matrix into MATLAB 25 05 15 .35 .1 15.05 .2 a. Create a for loop to calculate A1024 b. Time the above for loop by using the MATLAB tic toc ability c. Store the time it takes to complete the loop as the variable t1. d. Calculate the eigenvectors and eigenvalues for the matrix A. Store the eigenvectors as P and the eigenvalues as D e. Calculate the inverse of P. f. Calculate A1021 by using the diagonalization method g. Time the above calculation using the MATLAB tic toc ability and store the time it takes as the variable t2 h. Using the MATLAB function fprintf report the following: . Computation time to calculate A1021 using Ordinary Multiplication is: . computation time to calculate A1024 using Diagonalization is: » Diagonalization Method is faster by a factor of *than Ordinary Multiplication. Report all times to the 8th decimal place. To find " faster by a factor of", divide the fastest time by the slowest timc.Explanation / Answer
a.
A = [0.25 0.05 -0.1 ; 0.15 0.35 0.1 ; -0.15 -.05 0.2];
A1=1;
for i= 1 : 1024 % for loop that runs from 1 to exponent (1024)
A1 = A1 * A ;
end
b. and c.
t1= zeroes(1,100); % matrix of zeroes
for i= 1 : 1024 % for loop that runs from 1 to exponent (1024)
A1 = A1 * A ;
end
c.
t1= zeroes(1,100); % matrix of zeroes
tic; % timer start
for i= 1 : 1024 % for loop that runs from 1 to exponent (1024)
A1 = A1 * A ;
t1(n)=toc; % timer stop
end
plot(t1) % shows the elapsed time
d.
[P ,D]= eig(A) % P is the eigen vector and D is the eigen value of the matrix.
% eig function gives the two.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.