ex05_020508 - EP 471 Engineering Problem Solving II...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
02/05/08 EP 471 -- Engineering Problem Solving II Exercise 5 Initial vs Boundary Value Problems The difference between IVPs and BVPs is quite narrow. In IVPs we are given conditions at a common starting point (often, but not restricted to, time), and we obtain the solution by “marching forward” in the variable of interest. How we march forward defines the algorithm, such as the fourth order Runge-Kutta method embedded in ode45 . In BVPs, we are given conditions at the ends (or boundaries ) of an interval of interest. The methods used for solving such problems typically require simultaneous solution of all points of interest, since we have to encompass the ends and enforce the equation of interest in the bracketed domain. The current version of Matlab has a bvp-solver. It is used for a wide class of problems, and so for some simple problems, it has some features that seem like “overkill”. We’ll learn to use both the Matlab solver and set up some equations to solve ourselves when that is appropriate. For illustration, we’ll use a linear, second order ode 1 2 2 = + y dx y d to be solved over the domain 3 / 0 π x under a variety of boundary conditions. We will consider the following sets of boundary conditions: Set 1: 0 /3) ( 1 ) 0 ( = = y y Set 2: 0 /3) ( 1 ) 0 ( ' = = y y Set 3: 0 ) 3 / ( ' /3)/2 ( 1 ) 0 ( ' = + = y y y The solution to this linear, second order ode can be written as the sum of homogeneous and particular solutions: 1 ) cos( ) sin( ) ( + + = x B x A x y . For the different sets of boundary conditions given above, the analytical solutions can be found as: S e t 1 : ) sin( ) 3 / 2 ( 1 ) ( x x y = S e t 2 : ) sin( ) cos( ) 2 / 3 1 ( 2 1 ) ( x x x y + + = S e t 3 : ) sin( ) cos( ) 4 / 1 2 / 3 /( ) 1 4 / 3 ( 1 ) ( x x x y + + + =
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
02/05/08 Matlab’s bvp4c For illustration, you should download the harmonic_020508.m, harmonic_ode.m, harmonic_bc1.m, harmonic_bc2.m and harmonic_bc3.m scripts from the Matlab Scripts > Week_03 folder of the web page. It is perhaps easiest to begin by looking at the harmonic_ode.m script. The form of this should look familiar from our initial value problems. That is, to use Matlab’s bvp4c solver, we have to write the second order equation as a pair of first order equations, just as we did for ode45 . Now consider the main program, harmonic_020508.m. The key statements at the beginning of the main program are these: solinit1 = bvpinit(linspace(0,pi/3,10),[1 0]); sol1 = bvp4c( 'harmonic_ode' , 'harmonic_bc1' ,solinit1); The bvpinit utility provides both an initial distribution of points in x as well as a guess for the solution. In a linear problem like this one, there is no need to guess the solution, as one can be found directly without iteration. However, the solver is not restricted to linear equations and so its algorithm is iterative and it is expecting a guess. The linspace utility generates ten equally spaced points in x over the interval from 0 to π /3 to define a mesh for the algorithm.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/30/2012 for the course ENGINEERIN 471 taught by Professor Witt during the Spring '08 term at University of Wisconsin.

Page1 / 7

ex05_020508 - EP 471 Engineering Problem Solving II...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online