Partial Differential Equation Toolbox Previous page   Next Page

Solving the Parabolic Equation in Stages

The following example shows you how to solve a parabolic equation in stages and how to set an initial condition as a variable:

  1. At the MATLAB command prompt, type pdetool.
  2. Draw a rectangle in the GUI axes.
  3. From the Draw menu, select Export Geometry Description, Set Formula, Labels.
  4. In the Export dialog box, enter gd sf ns. Click OK.
  1. The exported variables are available in the MATLAB workspace.

  1. From the Boundary menu, select Boundary mode.
  2. From the Boundary menu, select Specify Boundary Conditions.
  3. Set the Neuman and Dirichlet boundary conditions. If these conditions are not the same for all the stages, set the conditions accordingly.
  4. From the Boundary menu, select Export Decomposed Geometry, Boundary Cond's.
  5. In the Export dialog box, enter g b. Click OK.
  6. From the PDE menu, select PDE Mode.
  7. From the PDE menu, select PDE Specification.
  8. Set the partial differential equation (PDE) coefficients, which are the same for any value of time.
  9. From the PDE menu, select Export PDE Coefficients.
  10. In the Export dialog box, enter c a f d. Click OK.
  11. From the Mesh menu, select Mesh mode.
  12. From the Mesh menu, select Parameters.
  13. Verify the initial mesh, jiggle mesh, and refine mesh values. Note that the mesh is fixed for all stages.
  14. From the Mesh menu, select Export Mesh.
  15. In the Export dialog box, enter p e t. Click OK.
  16. Save the workspace variables into a MAT-file by typing save data.mat at the MATLAB command prompt.
  17. Save the following code as an M-file:
  1. This M-file uses the variables you defined in the MATLAB workspace to solve a parabolic equation in stages. Within this M-file, you set the initial condition as a variable.


Previous page  Reducing the Parabolic Equation to Elliptic Equations The Hyperbolic Equation Next page