MATLAB Mathematics - SERC - Index of
MATLAB Mathematics - SERC - Index of MATLAB Mathematics - SERC - Index of
5 Differential Equations The example pdex3 uses pdeval to evaluate the derivative of the solution at xout = 0. See pdeval for details. Changing PDE Integration Properties The default integration properties in the MATLAB PDE solver are selected to handle common problems. In some cases, you can improve solver performance by overriding these defaults. You do this by supplying pdepe with one or more property values in an options structure. sol = pdepe(m,pdefun,icfun,bcfun,xmesh,tspan,options) Use odeset to create the options structure. Only those options of the underlying ODE solver shown in the following table are available for pdepe. The defaults obtained by leaving off the input argument options are generally satisfactory. “Changing ODE Integration Properties” on page 5-17 tells you how to create the structure and describes the properties. PDE Property Categories Properties Category Error control Step-size Property Name RelTol, AbsTol, NormControl InitialStep, MaxStep Example: Electrodynamics Problem This example illustrates the solution of a system of partial differential equations. The problem is taken from electrodynamics. It has boundary layers at both ends of the interval, and the solution changes rapidly for small t . The PDEs are ∂u --------- 1 0.024 ∂2 u 1 = ----------- ∂t ∂x 2 – Fu ( 1 – u 2 ) ∂u --------- 2 0.170 ∂2 u 2 = ----------- ∂t ∂x 2 + Fu ( 1 – u 2 ) where Fy ( ) = exp( 5.73y) – exp( – 11.46y) . The equations hold on an interval 0 ≤ x ≤ 1 for times t ≥ 0 . 5-100
Partial Differential Equations The solution u satisfies the initial conditions u 1 ( x, 0) ≡ 1 u 2 ( x, 0) ≡ 0 and boundary conditions ∂u --------- 1 ( 0, t) ≡ 0 ∂x u 2 ( 0, t) ≡ 0 u 1 ( 1, t) ≡ 1 ∂u --------- 2 ( 1, t) ≡ 0 ∂x Note The demo pdex4 contains the complete code for this example. The demo uses subfunctions to place all required functions in a single M-file. To run this example type pdex4 at the command line. See “PDE Solver Basic Syntax” on page 5-92 and “Solving PDE Problems” on page 5-94 for more information. 1 Rewrite the PDE. In the form expected by pdepe, the equations are 1 1 .∗ ∂ ---- u 1 ∂t u 2 = ∂ ----- 0.024( ∂u 1 ⁄ ∂x) ∂x 0.170( ∂u 2 ⁄ ∂x) + – Fu ( 1 – u 2 ) Fu ( 1 – u 2 ) The boundary conditions on the partial derivatives of u have to be written in terms of the flux. In the form expected by pdepe, the left boundary condition is 0 1 + u 2 0 .∗ 0.024( ∂u 1 ⁄ ∂x) 0.170( ∂u 2 ⁄ ∂x) = 0 0 5-101
- Page 184 and 185: 5 Differential Equations Function d
- Page 186 and 187: 5 Differential Equations dde23 prod
- Page 188 and 189: 5 Differential Equations The exampl
- Page 190 and 191: 5 Differential Equations solution y
- Page 192 and 193: 5 Differential Equations Example: C
- Page 194 and 195: 5 Differential Equations Changing D
- Page 196 and 197: 5 Differential Equations BVP Functi
- Page 198 and 199: 5 Differential Equations two-point
- Page 200 and 201: 5 Differential Equations The input
- Page 202 and 203: 5 Differential Equations 2 Pass the
- Page 204 and 205: 5 Differential Equations 3 Code the
- Page 206 and 207: 5 Differential Equations Finding Un
- Page 208 and 209: 5 Differential Equations vectorized
- Page 210 and 211: 5 Differential Equations There is a
- Page 212 and 213: 5 Differential Equations 3 Solve on
- Page 214 and 215: 5 Differential Equations hold off T
- Page 216 and 217: 5 Differential Equations Note The d
- Page 218 and 219: 5 Differential Equations legend('An
- Page 220 and 221: 5 Differential Equations Here, v(1-
- Page 222 and 223: 5 Differential Equations solution v
- Page 224 and 225: 5 Differential Equations Note The D
- Page 226 and 227: 5 Differential Equations After disc
- Page 228 and 229: 5 Differential Equations The output
- Page 230 and 231: 5 Differential Equations 2 Code the
- Page 232 and 233: 5 Differential Equations Note See t
- Page 236 and 237: 5 Differential Equations and the ri
- Page 238 and 239: 5 Differential Equations u1(x,t) 1
- Page 240 and 241: 5 Differential Equations Selected B
- Page 242 and 243: 6 Sparse Matrices Function Summary
- Page 244 and 245: 6 Sparse Matrices Function Summary
- Page 246 and 247: 6 Sparse Matrices This matrix requi
- Page 248 and 249: 6 Sparse Matrices S = (3,1) 1 (2,2)
- Page 250 and 251: 6 Sparse Matrices Now F = full(S) d
- Page 252 and 253: 6 Sparse Matrices Importing Sparse
- Page 254 and 255: 6 Sparse Matrices west0479 west0479
- Page 256 and 257: 6 Sparse Matrices The find Function
- Page 258 and 259: 6 Sparse Matrices of the rows and c
- Page 260 and 261: 6 Sparse Matrices The vertices of o
- Page 262 and 263: 6 Sparse Matrices 0 10 20 30 40 50
- Page 264 and 265: 6 Sparse Matrices 0 500 1000 1500 2
- Page 266 and 267: 6 Sparse Matrices simply sparse(m,n
- Page 268 and 269: 6 Sparse Matrices Similarly, S(:,p)
- Page 270 and 271: 6 Sparse Matrices The following MAT
- Page 272 and 273: 6 Sparse Matrices 0 Original 0 Reve
- Page 274 and 275: 6 Sparse Matrices QR Factorization
- Page 276 and 277: 6 Sparse Matrices shows that A has
- Page 278 and 279: 6 Sparse Matrices Functions for Ite
- Page 280 and 281: 6 Sparse Matrices set up the five-p
- Page 282 and 283: 6 Sparse Matrices Manipulating Spar
5 Differential Equations<br />
The example pdex3 uses pdeval to evaluate the derivative <strong>of</strong> the solution at<br />
xout = 0. See pdeval for details.<br />
Changing PDE Integration Properties<br />
The default integration properties in the <strong>MATLAB</strong> PDE solver are selected to<br />
handle common problems. In some cases, you can improve solver performance<br />
by overriding these defaults. You do this by supplying pdepe with one or more<br />
property values in an options structure.<br />
sol = pdepe(m,pdefun,icfun,bcfun,xmesh,tspan,options)<br />
Use odeset to create the options structure. Only those options <strong>of</strong> the<br />
underlying ODE solver shown in the following table are available for pdepe.<br />
The defaults obtained by leaving <strong>of</strong>f the input argument options are generally<br />
satisfactory. “Changing ODE Integration Properties” on page 5-17 tells you<br />
how to create the structure and describes the properties.<br />
PDE Property Categories<br />
Properties Category<br />
Error control<br />
Step-size<br />
Property Name<br />
RelTol, AbsTol, NormControl<br />
InitialStep, MaxStep<br />
Example: Electrodynamics Problem<br />
This example illustrates the solution <strong>of</strong> a system <strong>of</strong> partial differential<br />
equations. The problem is taken from electrodynamics. It has boundary layers<br />
at both ends <strong>of</strong> the interval, and the solution changes rapidly for small t .<br />
The PDEs are<br />
∂u<br />
--------- 1<br />
0.024 ∂2 u 1<br />
= -----------<br />
∂t<br />
∂x 2 – Fu ( 1 – u 2 )<br />
∂u<br />
--------- 2<br />
0.170 ∂2 u 2<br />
= -----------<br />
∂t<br />
∂x 2 + Fu ( 1 – u 2 )<br />
where Fy ( ) = exp( 5.73y)<br />
– exp( – 11.46y)<br />
. The equations hold on an interval<br />
0 ≤ x ≤ 1 for times t ≥ 0 .<br />
5-100