Let a = diag (1, - 2,1), a * Ba = 2ba-8e, find B

Let a = diag (1, - 2,1), a * Ba = 2ba-8e, find B


From a * Ba = 2ba-8e, (a * - 2e) BA = - 8e, B = - 8 (a * - 2e) - 1a-1 = - 8 [a (a * - 2e)] - 1 = - 8 (AA * - 2A) - 1 = - 8 (| a | e-2a) - 1 = - 8 (- 2e-2a) - 1 = 4 (E + a) - 1 = 4 [diag (2, - 1, 2



A = diag (1,1,1, what is the matrix like? Are these numbers on the diagonal, or are there non-zero in other places


This is the shorthand for diagonal matrix
Diag is the abbreviation of diagonal
diag(1,1,1,8) =
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 8



Matlab calculates with matrix structure: (diag) x = [123; 121] a = [456] multiplies every element of a by every column of X


(diag(a)*x')'



How can matlab turn a column vector into a diagonal matrix?
The elements of the column vector are the elements on the diagonal line of the diagonal matrix, and the other elements of the diagonal matrix are zero. What command is used in MATLB?


A=diag(b,n)
B is the column vector. When n is zero or not specified, it is the main diagonal
A=diag(b)
Just do it