MATLAB: Problem with equationsToMatrix function and symbolic matrix

equationstomatrix

My code obtains temperature distribution of a 2d plate. There is a for loop for 2 equations (one for heated side and one for interior points). I first create a symbolic matrix of temperature distribution. And problem starts here. Since i need every point as symbols, I used this:
T = sym('T',[n,n],'positive');
There is no problem with this notation up to 10×10 system. However, for 11 and above, when i use equationsToMatrix, first elements of the A matrix are dislocated. I think this is because the elements are named as T1_1, T1_2… and T11_1 comes before T1_1 or something like that. I am not really sure but the problem comes from naming elements. I don't know how to create a large symbolic matrices such as 10×10, 11×11, 15×15 without using this naming. But i need to fix the problem for matrices larger than 10×10. Can anyone give me an idea to fix it?

Best Answer

T = sym(compose('T%02d_%02d', (1:n).', 1:n))