I need to run the pdetool analysis several times for different values of pde coefficients. Repeating this procedure for different meshes is not convenient using the pdetool GUI.

Is there a way to automate the whole process via a .m file? The .m file should read the pde coefficients via the Matlab command prompt and should return the mesh (p, e, t) and solution (u) after the pde solution is complete.

Appreciate help in advance.


pdetool is an easy way for first-time users to get started with MATLAB PDE Toolbox. It can also be used for some realistic analyses since it supports a non-trivial subset of the capability of the toolbox. However, I know of no straightforward way to use it as part of an automated analysis.

The recommended approach for automating a PDE Toolbox analysis is to perform all operations using function calls from within a MATLAB script. All of the runable examples that are shipped with PDE Toolbox use this approach.

Geometry, mesh, and coefficient creation using PDE Toolbox function calls are relatively straightforward-- essentially the same as performing the step in pdetool. Assigning boundary conditions from the script is significantly different than within pdetool and, perhaps, it is not immediately obvious how to do this. The recommended approach is by using a user-written function called a "boundary file" in the PDE Toolbox documentation. This is documented here:



A good, example showing a complete analysis is here:


| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.