Different dimension matrix addition

조회 수: 1 (최근 30일)
Nir Vaishnav
Nir Vaishnav 2022년 7월 18일
댓글: Nir Vaishnav 2022년 7월 18일
I have a 2×2 matrix and i want to add it to a 4×4 matrix. How shall i proceed to do this?
  댓글 수: 2
KSSV
KSSV 2022년 7월 18일
How you would like to add? How can you add them?
Nir Vaishnav
Nir Vaishnav 2022년 7월 18일
i want it in the form of 4x2 matrix.

댓글을 달려면 로그인하십시오.

채택된 답변

KSSV
KSSV 2022년 7월 18일
Is this what you want?
A = rand(2) ;
B = rand(4) ;
iwant = repmat(A,2,2)+B
iwant = 4×4
0.2803 0.8238 0.4495 1.2927 1.3378 0.3492 1.1742 1.1508 0.9659 1.5570 0.9271 1.4413 1.0116 1.0375 1.2757 0.6122

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by