Creating Matrix provided elements
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Karthik Nagaraj
el 22 de Jul. de 2021
Comentada: Karthik Nagaraj
el 24 de Jul. de 2021
From a Hermititan (complex skew symmetric) matrix of order N (Asssume N=15) a column vector is created such that all the diagonal elements are placed first and then the ordered pair of real and imaginary parts of upper triangle matrix are placed next. Since it is hermitian matrix the upper and lower triangle elements have same set of real and imaginary elements.
For example for N=15x15 matrix the vector looks like this
[D1, D2, D3,...........,D15, R11, I11,R12, I12,.... ,R15, I15] in total 225 elements column vector.
How to construct back the matrix given this vector?
4 comentarios
Jan
el 23 de Jul. de 2021
What is R1_2 compared to L1_2? Should it be L2_1? If it is a hermitian matrix, why are the L elements stored?
Please explain exactly, what the inputs are. Use a 4x4 matrix to avoid the need to use unclear abbreviations.
Karthik Nagaraj
el 23 de Jul. de 2021
Editada: Karthik Nagaraj
el 23 de Jul. de 2021
Respuesta aceptada
Jan
el 24 de Jul. de 2021
Editada: Jan
el 24 de Jul. de 2021
A = rand(4) + 1i * rand(4);
A = A + A'; % Hermitian
% Convert to vector:
D = diag(A).';
L = triu(A, 1);
Lf = L(L ~= 0).';
Lv = [real(Lf); imag(Lf)];
VU = [D, Lv(:).'];
% And backwards:
n = sqrt(numel(VU));
L = triu(ones(n), 1);
L(L==1) = VU(n+1:2:n*n) + 1i * VU(n+2:2:n*n);
% Or: L(L==1) = [1, 1i] * reshape(VU(n+1:n*n), 2, [])
B = diag(VU(1:n)) + L + L';
isequal(A, B)
Más respuestas (0)
Ver también
Categorías
Más información sobre Operating on Diagonal Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!