Hi,
The output does not seem right because you are mixing 2 things together. In the line 41 and line 42 of your code you are doing:
x = 20; y = 10; % Line 41
[x, y] = meshgrid(1:(n * m), 1:(n * m)); % Line 42
So because of the 42nd line, x is now not 20 and y is not 10 but rather output of the meshgrid.
This is why you have a warning at variable x and variable y at line 41. If you hover over them you will see messages like: "The value assigned to variable 'x' might be unused" and "The value assigned to variable 'y' might be unused" respectively.
To correct this, you can rather use variables like T_i and T_0 and save the respective values in these variables and don't mix it up with x and y.
So the code should look like:
x = 20; y = 10; % Line 41
[x, y] = meshgrid(1:(n * m), 1:(n * m)); % Line 42
You can refer to Variable Names MathWorks Documentation page to learn more on proper variables naming and avoid conflicting.