pdeval
Evaluates a pdepe solution and its derivative at chosen points.
Category: Mathematics > Numerical Integration and Differential Equations
Syntax
[uout, duoutdx] = pdeval(m, xmesh, ue, xout)
Interpolates the solution ue (one time slice) at the points xout.
Description
pdepe returns values only at the mesh points. pdeval interpolates with the same discretization the solver uses, so the derivative it returns is consistent with the flux used in the equation.
To see the solution over time, call it once for each row of sol.
Input arguments
m- Symmetry, as given to
pdepe. xmesh- The mesh used with
pdepe. ue- Row of the solution at a fixed time, for example
sol(end, :, 1). xout- Points at which to evaluate, inside the mesh range.
Output arguments
uout- Interpolated solution values.
duoutdx- Interpolated spatial derivative.
Example
Value between mesh points
m = 0;
x = linspace(0, 1, 11);
t = linspace(0, 0.1, 5);
sol = pdepe(m, @(x, t, u, dudx) deal(1, dudx, 0), @(x) sin(pi*x), @(xl, ul, xr, ur, t) deal(ul, 0, ur, 0), x, t);
u = pdeval(m, x, sol(end, :, 1), 0.55);
fprintf('%.3f\n', u)
Output
0.366