shifted triangular matrix array

조회 수: 2 (최근 30일)
SV
SV 2019년 12월 6일
댓글: SV 2019년 12월 6일
If I have matrix a=[1 2; 3 4; 5 6; 7 8] (dimension 4x2) and i want to calculate
A= [1 2 0 0 0 0 0 0;
3 4 1 2 0 0 0 0;
5 6 3 4 1 2 0 0;
7 8 5 6 3 4 1 2]
(dimension 4x8),
how can i do?
Thanks.

채택된 답변

Matt J
Matt J 2019년 12월 6일
편집: Matt J 2019년 12월 6일
ac=num2cell([0,0;a],2);
T=toeplitz(1:4,[1,zeros(1,3)]);
A=cell2mat(ac(T+1))
A =
1 2 0 0 0 0 0 0
3 4 1 2 0 0 0 0
5 6 3 4 1 2 0 0
7 8 5 6 3 4 1 2
  댓글 수: 3
Image Analyst
Image Analyst 2019년 12월 6일
Jesus, can you "Accept this answer" to give Matt credit for it? Thanks in advance.
SV
SV 2019년 12월 6일
Amazing! Thank for your help

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by