MATLAB: Creating a matrix using diag

creating matrixdiagmatrix arraymatrix manipulation

Hi,
Would you please help me to write a script with "diag" command to create the matrix as shown in image. http://s1.postimage.org/5i4gd1esv/matrix.jpg By they way, it's a 99 X 99 matrix.
Thank you, John

Best Answer

>> z=zeros(3,1); z(1)=2; z(2)=-1; A=toeplitz(z)
A =
2 -1 0
-1 2 -1
0 -1 2