Hallo all, I'm trying to create this matrix (Toeplitz Matrix):
1 0 0 0
2 1 0 0
3 2 1 0
0 3 2 1
0 0 3 2
0 0 0 3 how can I achieve that ?
thanks for help

 채택된 답변

Sean de Wolski
Sean de Wolski 2011년 5월 13일

1 개 추천

T =tril(toeplitz([1 2 3 0 0 0 ],[1 2 3 0]))

댓글 수: 2

hunterilmenau Abdulkarim
hunterilmenau Abdulkarim 2011년 5월 13일
Hi
many thanks Sean , but what in case of a general vector . i.e, in this case h=[1 2 3] , what if I want to make it general for any given vector h ?
Sean de Wolski
Sean de Wolski 2011년 5월 13일
Oleg's method is better because it doesn't require the call to tril:
v = 1:5;
T = toeplitz([v(:);zeros(numel(v),1)],zeros(numel(v)+1,1))

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

추가 답변 (2개)

Oleg Komarov
Oleg Komarov 2011년 5월 13일

2 개 추천

toeplitz([1 2 3 0 0 0],[1 0 0 0])

댓글 수: 1

hunterilmenau Abdulkarim
hunterilmenau Abdulkarim 2011년 5월 13일
Hi
many thanks Oleg , but what in case of a general vector . i.e, in this case h=[1 2 3] , what if I want to make it general for any given vector h ?

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

hunterilmenau Abdulkarim
hunterilmenau Abdulkarim 2011년 5월 13일

0 개 추천

Hi guys ,
thanks again , it worked , I just modified as follows:
t=toeplitz([h zeros(1,7)],[1 0 0 0 0 0 0 0])
where h is the original vector.
cheer u

댓글 수: 1

Sibo Van Gool
Sibo Van Gool 2021년 10월 8일
For a more generalized version:
t = toeplitz([h zeros(1,length(h)-1)],[h(1) zeros(1, length(h)-1)])

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

카테고리

도움말 센터 및 File Exchange에서 Linear Algebra에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by