Matlab: How to compute the inverse of a matrix

故事扮演 提交于 2019-12-12 03:44:16

问题


I want to find the T inverse as given in the picture. The first picture is the matrix T and the other is T inverse.

I = eye(3);
T = [I/2, (j/2)*I, 0;
     I/2,  (-j/2)*I, 0;
     0,0,I];

Error using horzcat CAT arguments dimensions are not consistent.

Then I tried with I = eye(2) and got the same error. What is the proper way?


回答1:


Given

I = eye(3);

you want to multiply element-wise using .* with A (make sure you use the imaginary unit 1j and not an undefined variable j)

A = [1/2, (1j/2), 0;
     1/2,  (-1j/2), 0;
     0,0,1];

to get T

T = A.*I

But apart from that it feels like you actually want to multiply A with a constant C = I = 1

T = A.*1

The inverse you obtain with the inverse function:

Tinv = inv(T)


来源:https://stackoverflow.com/questions/43177790/matlab-how-to-compute-the-inverse-of-a-matrix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!