tags:

views:

61

answers:

1

How can I create the following matrix?

[0 0 0 
8  0 0 
9  8 0 
6  9 8
5  6 9
4  5 6]
+1  A: 

How about the toeplitz function?

c=[0 8 9 6 5 4 3]
r=[0 0 0]
t=toeplitz(c,r)

(Disclaimer: untested!)

T should be:

0 0 0
8 0 0 
9 8 0 
6 9 8 
5 6 9 
4 5 6 
3 4 5
Jim Lewis
the last element of the vector is 3 : in the matrix i want to creat the last element in colomn1 is 4, the matrix order is 6×3 When using the toeplitz(c,r) the last element in clo.1 =3 and the matrix order is 7×3 i want general rule to use in simulation
blue_arkedia
@blue: Sorry, I thought maybe it was just a typo that the "3" was missing. Anyway, toeplitz sounds like exactly what you need; you just need to adjust the "c" ("column") argument to generate the output matrix you're looking for.
Jim Lewis

related questions