Matlab:如何计算矩阵的逆 [英] Matlab: How to compute the inverse of a matrix
问题描述
我想找到图片中给定的T倒数.第一张图片是矩阵T,另一张图片是T逆.
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];
使用horzcat时出错 CAT参数的尺寸不一致.
Error using horzcat CAT arguments dimensions are not consistent.
然后我尝试使用I = eye(2)
并得到了相同的错误.正确的方法是什么?
Then I tried with I = eye(2)
and got the same error. What is the proper way?
推荐答案
给出
I = eye(3);
您要使用以下方法乘以 逐元素 .*
和A
(确保使用虚数单位 1j
而不是未定义的变量j
)
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];
获取T
T = A.*I
但是除此之外,您实际上还想将A
与常数C = I = 1
But apart from that it feels like you actually want to multiply A
with a constant C = I = 1
T = A.*1
通过 inv
erse 功能:
The inverse you obtain with the inv
erse function:
Tinv = inv(T)
这篇关于Matlab:如何计算矩阵的逆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!