Functions > Solving and Optimization > Differential Equation Solvers > Partial Differential Equation Solver
Partial Differential Equation Solver
numol(x_endpts, xpts, t_endpts, tpts, num_pde, num_pae, pde_func, pinit, bc_func)
Returns an [xpts x tpts] matrix containing the solutions to the one-dimensional Partial Differential Equation (PDE) in pde_func. Each column represents a solution over one-dimensional space at a single solution time. For a system of equations, the solution for each function is appended horizontally, so the matrix always has xpts rows and tpts * (num_pde + num_pae) columns. The solution is found using the numerical method of lines.
Arguments
x_endpts, t_endpts are two-element column vectors that specify the real endpoints of the integration regions.
xpts, tpts are the integer number of points in the integration regions at which to approximate the solution.
num_pde, num_pae are the integer number of partial differential and partial algebraic equations (PAEs) respectively. num_pde must be at least 1, num_pae can be 0 or greater.
pde_func is a vector function of x, t, u, ux and uxx of length (num_pde + num_pae). It contains the right-hand sides of the PDEs/PAEs, and assumes that the left-hand sides are all ut. The solution, u, is assumed to be a vector of functions.
If you are working with a system of PDEs, each u on each row of pde_func is defined by a subscript using the index operator, and also the literal subscript operator. For example, u[0 refers to the first function in the system, and ux[1 refers to the first derivative of the second function in the system.
pinit is a vector function of x of length (num_pde + num_pae) containing initial conditions for each function in the system.
bc_func is a num_pde * 3 matrix containing rows of the form:
For Dirichlet boundary conditions
[bc_left(t)
bc_right(t)
"D"]
or
For Neumann boundary conditions
[bc_left(t)
bc_right(t)
"N"]
In the case that the PDE for the corresponding row contains second partial derivatives, both left and right conditions are required.
If only first partial derivatives are present in a particular PDE, then one or the other boundary condition function should be replaced with "NA" and the last entry in the row is always "D."
If no partial derivatives are present for a particular equation in a system, then that row in the matrix is ignored, and can be filled in as ("NA" "NA" "D").
Watch this video to learn more about solving partial differential equations with numol:
Additional Information
Algebraic constraints are allowed, for example, 0 = u2(x) + v2(x) − w(x) for all x.
The number of boundary functions required matches the order of spatial derivative for each PDE, guaranteeing unique solutions.
Only hyperbolic and parabolic PDEs can be solved using numol. For an elliptic equation, such as Poisson's equation, use relax or multigrid.
Was this helpful?