How to take Inverse of a 6x6 cell array in MATLAB?

3 次查看(过去 30 天)
I have a 6x6 cell array(C_dry ). Each element in this array is 142x1 matrix.
How to take inverse of this array?
C_dry = {A B F 0 0 0
B A F 0 0 0
F F C 0 0 0
0 0 0 D 0 0
0 0 0 0 D 0
0 0 0 0 0 M}; %6x6 cell array
When i run below command
S_d = pinv(C_dry);
follwoing error appears,
Undefined function 'svd' for input arguments
of type 'cell'.
Error in pinv (line 18)
[U,S,V] = svd(A,'econ');
  2 个评论
Stephen23
Stephen23 2020-9-16
"I have a 6x6 cell array(C_dry ). Each element in this array is 142x1 matrix. How to take inverse of this array?"
What is your definition of "inverse" for a cell array where each cell contains a 142x1 matrix?
M bilal
M bilal 2020-9-16
i finally understood , inverse will not work for this so of transpose. i can only use follwoing,in order to get rid of this problem
S_d = C_dry;

请先登录,再进行评论。

回答(2 个)

madhan ravi
madhan ravi 2020-9-16
Assuming by inverse you mean transpose :
C_dry = cellfun(@transpose, C_dry, 'un', 0)
  7 个评论
M bilal
M bilal 2020-9-16
编辑:M bilal 2020-9-16
after inverse, i need C_dry as a 6x6 cell, having each element asa 142x1 double datatype column matrix.

请先登录,再进行评论。


Walter Roberson
Walter Roberson 2020-9-16
If you just happen to mean that you want to take
C_dry(K) = pinv([
A(K) B(K) F(K) 0 0 0
B(K) A(K) F(K) 0 0 0
F(K) F(K) C(K) 0 0 0
0 0 0 D(K) 0 0
0 0 0 0 D(K) 0
0 0 0 0 0 M(K)
])
for all 142 values, then:
syms A_ B_ F_ C_ D_ M_
C_dry_ = simplify(pinv([A_ B_ F_ 0 0 0; B_ A_ F_ 0 0 0; F_ F_ C_ 0 0 0; 0 0 0 D_ 0 0; 0 0 0 0 D_ 0; 0 0 0 0 0 M_]));
D3 = @(M) reshape(M,1,1,[]);
C_dry = subs(C_dry_, {A_, B_, C_, D_, F_, M_}, {D3(A), D3(B), D3(C), D3(D), D3(F), D3(M)});
The resulting C_dry would be 6 x 6 x numel(A)

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by