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

조회 수: 2 (최근 30일)
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 CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by