Question

In: Computer Science

MATLAB CODE: A particular 3x3 linear transformation A has eigenvalues of -1, 2, and 4, and...

MATLAB CODE:

A particular 3x3 linear transformation A has eigenvalues of -1, 2, and 4, and corresponding eigenvectors with directions of [1;1;0], [0;1;l], and [1;1;1], respectively. Because eigenvectors must have unit length, you will need to normalize the given vectors by the length of each array to find the actual eigenvectors. Given this information, and using the eigen decomposition, find the linear transformation A. Hint: you can use the diag() function to form the D matrix from the provided eigenvalues. Once A is found, verify your answer using the Matlab eig() function, which takes an n x n matrix A as an argument and returns the eigenvector (P2) and diagonal eigenvalue (D2) matrices associated with A: [P2,D2] = eig(A)P and P2 should share the same columns, while D and D2 should share the same diagonal elements

Solutions

Expert Solution

Follow the comments in the code to understand:

%% create a diagonal matrix from the given eigen values
D = diag([4,2,-1],3,3)

%% Normalize the vectors
%% To normalize, divide the vector by its magnitude
p3 = [1/sqrt(3); 1/sqrt(3); 1/sqrt(3)];
p2 = [0; 1/sqrt(2); 1/sqrt(2)];
p1 = [1/sqrt(2); 1/sqrt(2);0];

%% create the modal matrix p
P = [p3,p2,p1]

%% find the original matrix by the formula A = P D P^-1
A = P*D*inv(P)

%% find the values using matlab
[P2, D2] = eig(A)

Output:

D =

Diagonal Matrix

   4   0   0
   0   2   0
   0   0  -1

P =

   0.57735   0.00000   0.70711
   0.57735   0.70711   0.70711
   0.57735   0.70711   0.00000

A =

   4  -5   5
   2  -3   5
   2  -2   4

P2 =

  -5.7735e-01  -4.4869e-16  -7.0711e-01
  -5.7735e-01   7.0711e-01  -7.0711e-01
  -5.7735e-01   7.0711e-01   3.8858e-16

D2 =

Diagonal Matrix

   4.00000         0         0
         0   2.00000         0
         0         0  -1.00000

Notice that although the diagonal matrix D2 and D are same , the values of columns of P and P2 are not same[but equivalent]. Why are they equivalent? Because the eigen vector corresponding to an eigen vector E are kE, where k is any constant. i.e., corresponding to [1;1;0] there are infinite number of eigen vectors such as [2;2;0] , [-3;-3;0] etc. Both are different but represent the same eigen vector.

Also the values are close to 0 but not exaclty 0 in P2 because matlab uses floating point arithmetic which produces approximate results.


Related Solutions

Suppose that a 2 × 2 matrix A has eigenvalues λ = -3 and 4, with...
Suppose that a 2 × 2 matrix A has eigenvalues λ = -3 and 4, with corresponding eigenvectors [1m1]and [7,2], respectively. Find A^2.
MATLAB question! 4. (a) Modify the code, to compute and plot the quantity E = 1/2mv^2...
MATLAB question! 4. (a) Modify the code, to compute and plot the quantity E = 1/2mv^2 + 1/2ky^2 as a function of time. What do you observe? Is the energy conserved in this case? (b) Show analytically that dE/dt < 0 for c > 0 while dE/dt > 0 for c < 0. (c) Modify the code to plot v vs y (phase plot). Comment on the behavior of the curve in the context of the motion of the spring....
For problems 1-4 the linear transformation T/; R^n - R^m  is defined by T(v)=AV with A=[-1 -2...
For problems 1-4 the linear transformation T/; R^n - R^m  is defined by T(v)=AV with A=[-1 -2 -1 -1 2 1 0 -4 4 6 1 15] 1.   Find the dimensions of R^n and R^m (3 pts) 2.   Find T(<-2, 1, 4, -1>) (5 pts) 3.   Find the preimage of <-6, 12, 4> (8 pts) 4.   Find the Ker(T) (8 pts)
2. Give an example of a linear transformation L : lR^2 arrow lR^2 which has a...
2. Give an example of a linear transformation L : lR^2 arrow lR^2 which has a repeated real eigenvalue, but in which lR^2 does posses a basis of eigenvectors.
Find the arclength of y=3x3/2 on 1≤x≤2
Find the arclength of y=3x3/2 on 1≤x≤2
ODE: draw the phase by MATLAB ?′1=−8?1−2?2 and ?′2=2?1−4?2
ODE: draw the phase by MATLAB ?′1=−8?1−2?2 and ?′2=2?1−4?2
pls, I need Matlab code for, OFDM modulation (Matlab demo by at least 4 carriers)
pls, I need Matlab code for, OFDM modulation (Matlab demo by at least 4 carriers)
Use MATLAB to solve graphically the planar system of linear equations x +4 y = −4...
Use MATLAB to solve graphically the planar system of linear equations x +4 y = −4 4x +3 y =4 to an accuracy of two decimal points. Hint: The MATLAB command zoom on allows us to view the plot in a window whose axes are one-half those of original. Each time you click with the mouse on a point, the axes’ limits are halved and centered at the designated point. Coupling zoom on with grid on allows you to determine...
This is the Matlab practice so needs Matlab code 2. Numerical Integration Consider an industrial tank...
This is the Matlab practice so needs Matlab code 2. Numerical Integration Consider an industrial tank in the shape of an inverted cone. The radius of the tank at the top rim is 3 m, and the total height of the tank is 4 m. The volume of the tank in m3 is given by: V = (1/3) R2 H. The volume of liquid in the tank when filled to a height h measured from the bottom vertex is: V...
(1)Using the Matlab code developed in Software Assignment #1: a. Convert the code that generates the...
(1)Using the Matlab code developed in Software Assignment #1: a. Convert the code that generates the random number (H,T) with equal probabilities into a function called myBernolli(p, S) that takes as an input the probability of success p and S is the outcome defined as success (either T or H) and returns the outcome of the trial (either T or H). b. Test that your function is actually producing the successful outcome with probability p by running the function in...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT