Functions > Solving and Optimization > Differential Equation Solvers > Example: Heat Flow on a Square Plate - II
Example: Heat Flow on a Square Plate - II
Solve for the steady-state temperature distribution of a square plate using the partial differential equation solver relax.
Solving Poisson's Equation
Solve the heat equation where values of the source function are known and the boundary conditions are non-zero.
 
The relax function is based on an entirely different solving method, and hence requires a different set of arguments.
1. Define five square matrices a, b, c, d, and e to contain the coefficients for the Laplacian approximation:
 
These arrays can be of any size you specify. The larger they are, the finer the mesh in the solution.
2. Define the dimension of the square plate:
3. Define the coefficients:
4. Define the strength and position of a constant source.
5. Define a square matrix f, of size equal to the size of the grid, to contain the known boundary values of function F(x,y) and guess values for the unknown interior values.
Boundary condition along the top:
Boundary condition along the bottom:
Boundary condition along the edges:
6. Define the Jacobi spectral radius variable r, a real number between 0 and 1.
 
This parameter controls the convergence of the algorithm. If you see the error message "too many iterations", then try reducing r.
7. Call the relax function:
8. Create a 3D plot to show the heat distribution over the square plate.
9. Create a contour plot to show the lines of constant temperature.
Was this helpful?