This example shows how to enter coefficients in the PDE app.
Caution: Do not include spaces in your coefficient strings in the PDE app. The string parser can misinterpret a space as a vector separator, as when a MATLAB® vector uses a space to separate elements of a vector.
The PDE is parabolic,
with the following coefficients:
d = 5
a = 0
f is a linear ramp up to 10, holds at 10, then ramps back down to 0:
c = 1 +.x2 + y2
These coefficients are the same as in Solve PDE with Coefficients in Functional Form.
Write the following file
save it on your MATLAB path.
function f = framp(t) if t <= 0.1 f = 10*t; elseif t <= 0.9 f = 1; else f = 10-10*t; end f = 10*f;
Open the PDE app, either by typing
the command line, or selecting PDE from the Apps menu.
Select PDE > PDE Specification.
Select Parabolic equation. Fill in the coefficients as pictured:
The PDE app interprets all inputs as strings. Therefore, do
not include quotes for the
Select Options > Grid and Options > Snap.
Select Draw > Draw Mode, then draw a rectangle centered at (0,0) extending to 1 in the x-direction and 0.4 in the y-direction.
Draw a circle centered at (0.5,0) with radius 0.2
Change the set formula to
Select Boundary > Boundary Mode
Click a segment of the outer rectangle, then Shift-click the other three segments so that all four segments of the rectangle are selected.
Double-click one of the selected segments.
Fill in the resulting dialog box as pictured, with Dirichlet
boundary conditions h =
1 and r =
Select the four segments of the inner circle using Shift-click, and double-click one of the segments.
Select Neumann boundary conditions,
and set g =
x.^2+y.^2 and q =
1. Click OK.
Click to initialize the mesh.
Click to refine the mesh. Click again to get an even finer mesh.
Select Mesh > Jiggle Mesh to improve the quality of the mesh.
Set the time interval and initial condition by selecting Solve
> Parameters and setting Time =
linspace(0,1,50) and u(t0) =
Solve and plot the equation by clicking the button.
Match the following figure using Plot > Parameters.
Click the Plot button.