How to make a matrix of matrices in Matlab? (to be used to solve a system of linear equations)

2 ビュー (過去 30 日間)
Pocho
Pocho 2012 年 8 月 22 日
Hi,
I need to make a matrix of matrices in Matlab to later be used when solving a system of linear equations.
I know one solution is to create a mxn cell, and fill each cell with a matrix or vector, but you can't use cells with linsolve(), so this won't help me.
How can I have a matrix of matrices in Matlab?
Thanks!
clarification:
I have one cell structure
A = [25x25 double] [25x1 double] [25x1 double]
[ 1x25 double] [ 0] [ 0]
[ 1x25 double] [ 0] [ 0]
and another
b = [ 0]
[25x1 double]
[ 1]
And I want to do linsolve(A, b). Is this possible?

回答 (1 件)

José-Luis
José-Luis 2012 年 8 月 22 日
Yes, you can, you need to use the curly braces:
test = cell(2,1);
test(1) = {rand(10)};
test(2) = {rand(10,1)};
linsolve(test{1},test{2});
  3 件のコメント
Pocho
Pocho 2012 年 8 月 22 日
Ok, I should have clarified.
I'm have one cell structure
A = [25x25 double] [25x1 double] [25x1 double]
[ 1x25 double] [ 0] [ 0]
[ 1x25 double] [ 0] [ 0]
and another
b = [ 0]
[25x1 double]
[ 1]
And I want to do linsolve(A, b). Is this possible?
José-Luis
José-Luis 2012 年 8 月 22 日
編集済み: José-Luis 2012 年 8 月 22 日
linsolve(cell2mat(A),cell2mat(b));
Provided the dimensions match.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by