mase201sp09_Apr14_PRINTABLE

# mase201sp09_Apr14_PRINTABLE - Numerical Solution of...

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

Numerical Solution of Ordinary Diff Eqns • Intro to numerical solution of Ordinary Differential Equations (ODEs): • Runge-Kutta methods • MATLAB ODE solvers (sec 10.4) • Solving systems of first-order ODEs w/ MATLAB omment on Lab 14 Part VI Comment on Lab 14, Part VI • Examples of systems of ODEs •2 nd order ODEs as a system of 1 st order ODEs y Predator-Prey problem Boundary Value Problems 4/14/2009 1 MASE201 Spring 2009 Solving a system of ODEs he same methods used to solve a single ODE can The same methods used to solve a single ODE can be used to solve a system of ODEs • There is one independent variable and many ( n ) dependent variables with one ODE per dependent variable (denoted j ): he numerical solution of the system can be stated  n j j j y y y y t f dt dy , , , , , , 2 1 The numerical solution of the system can be stated as: : that such ) ( find , to 1 For t y n j j (0) conditions initial the with ) , , ... , , ( o j j 2 1 y y t y y y f dt dy n j 4/14/2009 2 MASE201 Spring 2009 ] , 0 [ domain the over final t Solving a system of ODEs in MATLAB he built MATLAB functions can solve a system of The built-in MATLAB functions can solve a system of ODEs. The syntax is the same as for a single ODE,except that yo becomes a vector , rather than a scalar and odefun must return a column vector with the values of f 1 , f 2 etc. a function m e: In a function m-file: function dyvecdt = odesysfun(x,y) k=10; m=1; dyvecdt(1,1)= yvec(2); %velocity is dx/dt dyvecdt(2,1)= -k/m*yvec(1); %acceleration is dv/dt n the MATLAB command line: On the MATLAB command line: >> [t,y]=ode45(@odesysfun,[0 10],[0 3]); % Note that t is a column vector of some length n and y is an n x 2 4/14/2009 3 % matrix. Each column contains the values of one dependent variable % (x and v respectively) MASE201 Spring 2009 Initial Value Problems and Boundary Value Problems hen solving an ODE arbitrary constants • When solving an ODE, arbitrary constants appear in the solution. or a second rder ODE or higher it is • For a second-order ODE or higher, it is important to distinguish between initial value nd boundary value problems and boundary value problems – When the independent variable is time, the ODE is called an initial value problem and we need to specify y (0), d y /d t (0) etc. – When the independent variable is position (e.g.) e DE is called a oundary value roblem nd the ODE is called a boundary value problem and we can specify some combination the value of the dependent variable or its derivatives at ifferent values of 4/14/2009 4 different values of x MASE201 Spring 2009

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

View Full Document
Reducing a second-order ODE second rder ODE can be reduced to a system of A second-order ODE can be reduced to a system of two first order ODEs as shown for the example below: 2 v dt dx kx dt x d m Let 0 2 x m k dt dv or kx dt dv m 0 Then Write the functions f 1 and f 2 that are functions of the independent variable t and the dependent variables x and
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 5

mase201sp09_Apr14_PRINTABLE - Numerical Solution of...

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

View Full Document
Ask a homework question - tutors are online