Solving PDE Problems
This section describes:
Example: A Single PDE
This example illustrates the straightforward formulation, solution, and plotting of the solution of a single PDE
This equation holds on an interval for times . At , the solution satisfies the initial condition
At and , the solution satisfies the boundary conditions
The demo |
pdepe. See Introduction to PDE Problems for more information. For this example, the resulting equation is
pdepecan use. The function must be of the form
scorrespond to the , , and terms. The code below computes
sfor the example problem.
In the function
ql correspond to the left boundary conditions (), and
qr correspond to the right boundary condition ().
pdepeto evaluate the solution. Specify the points as vectors
xplay different roles in the solver (see MATLAB Partial Differential Equation Solver). In particular, the cost and the accuracy of the solution depend strongly on the length of the vector
x. However, the computation is much less sensitive to the values in the vector
This example requests the solution on the mesh produced by 20 equally spaced points from the spatial interval [0,1] and five values of
t from the time interval [0,2].
m = 0, the functions pdex1pde, pdex1ic, and pdex1bc, and the mesh defined by x and t at which
pdepeis to evaluate the solution. The
pdepefunction returns the numerical solution in a three-dimensional array
kth component of the solution, , evaluated at
pdex1bcas function handles to
See the |
= t = 2. See "Evaluating the Solution at Specific Points" on page 14-119 for more information.
Evaluating the Solution at Specific Points
After obtaining and plotting the solution above, you might be interested in a solution profile for a particular value of
t, or the time changes of the solution at a particular point
u(:,k) (of the solution extracted in step 7) contains the time history of the solution at
u(j,:) contains the solution profile at
Using the vectors
u(j,:), and the helper function
pdeval, you can evaluate the solution
u and its derivative at any set of points
pdeval to evaluate the derivative of the solution at
xout = 0. See
pdeval for details.
|MATLAB Partial Differential Equation Solver||Changing PDE Integration Properties|