inverse of a subset of a matrix

5 次查看(过去 30 天)
Hi everyone,
I have a matrix that has an n by p dimension and I would like to grab all the 3x3 submatrices and inverse them. also by the end of the operation, I would like to put them back as n by p matrix.
As an exemple 3x28 matrix.
Hope to hear from you.

采纳的回答

Sahithi Kanumarlapudi
As 28 is not a multiple of 3 I am assuming that you are looking to invert 9 3x3 sub matrices I.e., till row 27
The following code can be used to obtain your required functionality where A is the matrix to be inverted
matLength = length(A);
r = rem(matLength,3);
mLength = matLength-r;
for i =1:3:mLength
x = A([i:i+2],:);
a = inv(x);
A([i:i+2],:) = a;
end
  1 个评论
zakaria azdad
zakaria azdad 2019-7-25
Sorry, for late reply.
Your guess was correct.
I have found another way to do it. I just converted each cell to matrix , invert it and put it back to a new cell with I just converted But it a bit longer than your method :)
Thanks a lot

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Environment and Clutter 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by