필터 지우기
필터 지우기

Creating a specific lower rectangular matrix

조회 수: 1 (최근 30일)
Amital
Amital 2012년 2월 24일
Hello Matlab experts!
I'm interested in creating a specific lower rectangular matrix while avoiding loops.
Step 1: I create the following column vector:
[ A1 A2 A3 . . . . An ]'
Where n is a predetermined integer (changes from one simulation to another).
Step 2: I create the following matrix:
A1 A1 A1 A1 . . . . A1
A2 A2 A2 A2 . . . . A2
A3 A3 A3 A3 . . . . A3
. . .
An An An An . . . . An
Step 3: I want to perform the following shifts: Shift the second column one step down, Shift the third column two steps down, etc. So eventually I'll get the following matrix:
A1 An An-1 An-2 . . . . A2
A2 A1 An An-1 . . . . A3
A3 A2 A1 An . . . . A4
A4 A3 A2 A1 . . . . A5
. . .
An An-1 An-2 An-3 . . . . A1
Step 4: I use the 'tril' function to get the matrix I'm interested in, which is:
A1 0 0 0 . . . . 0
A2 A1 0 0 . . . . 0
A3 A2 A1 0 . . . . 0
A4 A3 A2 A1 . . . . 0
. . .
An An-1 An-2 An-3 . . . . A1
I need assistance with performing step 3.
Maybe there are better ways to create this matrix, let me know.
Thanks, Amital

채택된 답변

Andrei Bobrov
Andrei Bobrov 2012년 2월 24일
A = 1:5;
out = tril(toeplitz(A))
  댓글 수: 1
Amital
Amital 2012년 2월 24일
Toeplitz! ofcourse!! thanks a lot . . .

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by