15.11.2014 Views

MATLAB Mathematics - SERC - Index of

MATLAB Mathematics - SERC - Index of

MATLAB Mathematics - SERC - Index of

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Boundary Value Problems for ODEs<br />

Note The demo threebvp contains the complete code for this example and<br />

solves the problem for λ = 2, n = 0.05, and several values <strong>of</strong> κ. The demo<br />

uses nested functions to place all functions required by bvp4c in a single<br />

M-file and to communicate problem parameters efficiently. To run this<br />

example, type threebvp at the <strong>MATLAB</strong> command prompt.<br />

The demo takes you through the following steps:<br />

1. Determine the Interfaces and Divide the Interval <strong>of</strong> Integration Into<br />

Regions<br />

Introducing an interface point at xc = 1 divides the problem into two regions<br />

in which the solutions remain smooth. The differential equations for the two<br />

regions are<br />

Region 1:<br />

v' = (C - 1)/n<br />

C' = (v * C - x)/ η<br />

Region 2:<br />

0 ≤ x ≤ 1<br />

1 ≤ x ≤ λ<br />

v' = (C - 1)/n<br />

C' = (v * C - 1)/ η<br />

Note that the interface xc = 1 is included in both regions. At xc = 1, bvp4c<br />

produces a left and right solution. These solutions are denoted as v(1 - ), C(1 - )<br />

and v(1 + ), C(1 + ) respectively.<br />

2. Determine the Boundary Conditions<br />

Solving two first order differential equations in two regions requires imposing<br />

four boundary conditions. Two <strong>of</strong> these conditions come from the original<br />

formulation; the others enforce the continuity <strong>of</strong> the solution across the<br />

interface xc = 1:<br />

v(0) = 0<br />

C( λ ) 1 = 0<br />

v(1-) v(1+) = 0<br />

C(1-) C(1+) = 0<br />

5-85

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!