Write a MATLAB program. Generate 10 10x10 random square matrices. Verify that th
ID: 2293648 • Letter: W
Question
Write a MATLAB program. Generate 10 10x10 random square matrices. Verify that the product of each of the matrices and its eigenvectors equals the product of its eigenvectors and the corresponding eigenvalues for these 10 square matrices. Hint: 1. Use the built-in function EIG. 2. To say that they are equal to each other, verify that the difference is very small.
square matrices (20 points) write a MATLAB progra generate 10 10 × 10 verify that the multiplication or eacn OT tnose matrices ana its eigenvectors eqúals the multiplication of its eigenvectors and the corre?pónding eigenvalues for these 10 square matrices. Hint: 1. Use the built-in function EIG. 2. To say that they are equal to each other, verify that the difference is verv small randomlv help eig EIG Eigenvalues and eigenvectors E = EIG(X) is a vector containing the eigenvalues of a square matrix )X [V,D]EIG(X) produces a diagonal matrix D of eigenvalues and a full matrix V whose colunns are the corresponding eigenvectors so that X*VW*D [V,D] EIG(X, nobalance performs the compu tation with balancing disabled, which sometimes gives more accurate results for certain problems with unusual scaling. If X is syunetric, EIGX, 'nobalance') is ignored since X is already balanced E EIG(A,B) is a vector containing the generalized eigenvalues of square matrices A and B [V,D] -EIG(A,B) produces a diagonal matrix D of generalized eigenvalues and a full matrixVwhose columns are the corresponding eigenvectors so that A*VBV*D (20 points)???MATLAB??,????10?10 × 10???,??? ?????????eigen vector??,????eigen vector?????? ??eigen value o (Hint: Matlab??eig??????,??????? ?????????????????????)Explanation / Answer
Matlabe Code: Try enter the dim value ===3 so you can understand there is minimum error
clear all;
clc;
% Enter the dimensions of the square matrix
dim = input('Enter the dimnesion of the matrix: ');
Matrix = cell(1,10);
EigenVectors =cell(1,10);
EigenValues=cell(1,10);
error=cell(1,10);
for i = 1:10
Matrix{1,i} = randi(dim,dim);
end
for i = 1:10
[EigenVectors{1,i},EigenValues{1,i}] = eig(Matrix{1,i})
end
% product of matrices with each eigen vector
for i = 1:10
error{1,i} = abs(Matrix{1,i}*EigenVectors{1,i} - EigenVectors{1,i}*EigenValues{1,i});
end
for i = 1:10
fprintf('Error for the Matrix %d% ',i)
Error = error{1,i}
end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.