Creating a matrix which contains submatrices

11 ビュー (過去 30 日間)
David Costanza
David Costanza 2020 年 4 月 13 日
回答済み: Akira Agata 2020 年 4 月 13 日
So i want to create 2nX2n matrix that asks a number from user which called n.Also this matrix has 4 of n x n submatrices that element of submatrices bottom left corner consist zeros ?

回答 (1 件)

Akira Agata
Akira Agata 2020 年 4 月 13 日
Assuming the submatrix is n-by-n Identity matrix, the solution would be like this:
n = input('Please enter n: ');
subMat = eye(n);
M = repmat(subMat,2,2);

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by