Learn yo use the tools for such a problem.
Here spdiags is the correct tool, creating a sparse matrix as a result.
Or, you could use my blktridiag tool, downloadable from the file exchange. blktridiag would also create the matrix as a sparse one. It is overkill for such a small problem however.
So for something as simple as a 5x5 matrix, the truly simplest way is to use diag to create THREE matrices, then adding them together. Thus create a mstrix with the main diagonal. Then create another with the sub-diagonal, with another call to diag. Finally create a matrix with the desired super-diagonal terms. Add the three matrices, and voila you are done.
I'll get you started:
A_sub = diag([9 10 11 12],-1);
0 0 0 0 0
9 0 0 0 0
0 10 0 0 0
0 0 11 0 0
0 0 0 12 0
You can do the rest now. In fact, you can use the above scheme to solve your problem all in one line of code, if you wish.
Remember that for larger problems, you should be learning to use the sparse matrix tools though. They will be hugely more efficient both in terms of time and memory, especially for a tridiagonal matrix. (Well, they will be more efficient if you use them properly.)