MATLAB Mathematics - SERC - Index of
MATLAB Mathematics - SERC - Index of MATLAB Mathematics - SERC - Index of
5 Differential Equations There is a shock at x = 0 when ε =1e−004. 2 1.5 1 0.5 solution y 0 −0.5 −1 −1.5 −2 −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 x Example: Using Continuation to Verify a Solution’s Consistent Behavior Falkner-Skan BVPs arise from similarity solutions of viscous, incompressible, laminar flow over a flat plate. An example is f′′′ + ff′′ + β( 1 – ( f′ ) 2 ) = 0 for β = 0.5 on the interval [0, ∞) with boundary conditions f( 0) = 0 , f′ ( 0) = 0 , and f′ ( ∞) = 1 . The BVP cannot be solved on an infinite interval, and it would be impractical to solve it for even a very large finite interval. So, the example tries to solve a sequence of problems posed on increasingly larger intervals to verify the solution’s consistent behavior as the boundary approaches ∞ . The example imposes the infinite boundary condition at a finite point called infinity. The example then uses continuation in this end point to get convergence for increasingly larger values of infinity. It uses bvpinit to extrapolate the solution sol for one value of infinity as an initial guess for the 5-76
Boundary Value Problems for ODEs new value of infinity. The plot of each successive solution is superimposed over those of previous solutions so they can easily be compared for consistency. Note The demo fsbvp contains the complete code for this example. The demo uses nested functions to place all required functions in a single M-file. To run this example type fsbvp at the command line. See “BVP Solver Basic Syntax” on page 5-65 and “Solving BVP Problems” on page 5-68 for more information. 1 Code the ODE and boundary condition functions. Code the differential equation and the boundary conditions as functions that bvp4c can use. The problem parameter beta is shared with the outer function. function dfdeta = fsode(eta,f) dfdeta = [ f(2) f(3) -f(1)*f(3) - beta*(1 - f(2)^2) ]; end % End nested function fsode function res = fsbc(f0,finf) res = [f0(1) f0(2) finf(2) - 1]; end % End nested function fsbc 2 Create an initial guess. You must provide bvp4c with a guess structure that contains an initial mesh and a guess for values of the solution at the mesh points. A crude mesh of five points and a constant guess that satisfies the boundary conditions are good enough to get convergence when infinity = 3. infinity = 3; maxinfinity = 6; solinit = bvpinit(linspace(0,infinity,5),[0 0 1]); 5-77
- Page 160 and 161: 5 Differential Equations 2 u′ i =
- Page 162 and 163: 5 Differential Equations dydt(i+1,:
- Page 164 and 165: 5 Differential Equations refine = 4
- Page 166 and 167: 5 Differential Equations Example: A
- Page 168 and 169: 5 Differential Equations function [
- Page 170 and 171: 5 Differential Equations Note The R
- Page 172 and 173: 5 Differential Equations 1 Robertso
- Page 174 and 175: 5 Differential Equations The MATLAB
- Page 176 and 177: 5 Differential Equations Summary of
- Page 178 and 179: 5 Differential Equations Problem Si
- Page 180 and 181: 5 Differential Equations Error Tole
- Page 182 and 183: 5 Differential Equations Troublesho
- 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 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 234 and 235: 5 Differential Equations The exampl
- 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
Boundary Value Problems for ODEs<br />
new value <strong>of</strong> infinity. The plot <strong>of</strong> each successive solution is superimposed<br />
over those <strong>of</strong> previous solutions so they can easily be compared for consistency.<br />
Note The demo fsbvp contains the complete code for this example. The demo<br />
uses nested functions to place all required functions in a single M-file. To run<br />
this example type fsbvp at the command line. See “BVP Solver Basic Syntax”<br />
on page 5-65 and “Solving BVP Problems” on page 5-68 for more information.<br />
1 Code the ODE and boundary condition functions. Code the differential<br />
equation and the boundary conditions as functions that bvp4c can use. The<br />
problem parameter beta is shared with the outer function.<br />
function dfdeta = fsode(eta,f)<br />
dfdeta = [ f(2)<br />
f(3)<br />
-f(1)*f(3) - beta*(1 - f(2)^2) ];<br />
end % End nested function fsode<br />
function res = fsbc(f0,finf)<br />
res = [f0(1)<br />
f0(2)<br />
finf(2) - 1];<br />
end % End nested function fsbc<br />
2 Create an initial guess. You must provide bvp4c with a guess structure<br />
that contains an initial mesh and a guess for values <strong>of</strong> the solution at the<br />
mesh points. A crude mesh <strong>of</strong> five points and a constant guess that satisfies<br />
the boundary conditions are good enough to get convergence when infinity<br />
= 3.<br />
infinity = 3;<br />
maxinfinity = 6;<br />
solinit = bvpinit(linspace(0,infinity,5),[0 0 1]);<br />
5-77