Creating a loop for a Matrix

I have a 4x4 Matrix and need to create all the minors of the matrix. How do I use a single variable to store all the minors of Matrix A? I know you are supposed to use the nested for loops somehow.

3 件のコメント

Jan
Jan 2011 年 10 月 20 日
Please post, what you have done so far.
Kevin
Kevin 2011 年 10 月 20 日
A=[5, 3, 0, 4; -4, 2, 7, -1; 0, 4, -2, -3; 1, 0, 3, 3]
Fangjun Jiang
Fangjun Jiang 2011 年 10 月 21 日
Wow, you created a matrix!

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

回答 (1 件)

Andrei Bobrov
Andrei Bobrov 2011 年 10 月 20 日

0 投票

A=rand(4);
[j1,i1] = meshgrid(1:size(A,1));
Out = arrayfun(@(i1,j1)det(A([1:i1-1,i1+1:end],[1:j1-1,j1+1:end])),i1,j1)

2 件のコメント

Kevin
Kevin 2011 年 10 月 20 日
I don't understand....I'm looking for a siingle variable M that stores all the minors? This doesn't even use the for loop.
Andrei Bobrov
Andrei Bobrov 2011 年 10 月 21 日
I do not understand what you want. Read the help for each function used in the code and will understand everything.

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

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

質問済み:

2011 年 10 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by