Bear with me as I try to explain what I want. I doubt anyone here will be able to walk me through this, but I've tried many different things and I'm all out of options.
In general, what I'm trying to get is a specific symmetric matrix where the entries are functions I have, evaluated at a grid of points (using the i and j corresponding to those grid points). What I first imagined doing was to try to make a matrix of function handles. Can't do this. The matrix I want is composed of (M-2)x(M-2) blocks of (N-2)x(N-2) entries. I have functions A, B, D and E. They are functions of 2 variables i,j (these come from the grid; the functions look like u(i+1,j)-2*u(i,j)+... etc). I want something resembling this:
And this continues on. The main diagonal of the whole MATRIX is a block with E running down the main diagonal of this BLOCK but evaluated at (2,2), (2,3), (2,4), etc.. The 2 off diagonals, next to E, are D, again evaluated at (2,2), (2,3), etc. as you go down in rows. The blocks to the right and under this block is the same idea but it's B along main diagonal and A on the 2 off diagonals. These blocks all continue down in this symmetric fashion, and the rest of is 0's. Again, (M-2)x(M-2) blocks of (N-2)*(N-2) entries. Let me do a specific example where N=M=5:
E D 0 B A 0 0 0 0 <--- evaluated at (2,2) D E D A B A 0 0 0 <--evaluated at (2,3) 0 D E 0 A B 0 0 0 <--evaluated at (2,4) B A 0 E D 0 B A 0<-- evaluated at (3,2) A B A D E D A B A<--evaluated at (3,3) 0 A B 0 D E 0 A B<-- evaluated at (3,4) 0 0 0 B A 0 E D 0<--evaluated at (4,2) 0 0 0 A B A D E D<--evaluated at (4,3) 0 0 0 0 A B 0 D E<-- evaluated at (4,4)
I challenge anyone to help me, after hours and hours of getting nowhere with this.