math 3341 introduction to scientific computing lab
play

MATH 3341: Introduction to Scientific Computing Lab Libao Jin - PowerPoint PPT Presentation

Lab 14: Built-in ODE Solvers in MATLAB MATH 3341: Introduction to Scientific Computing Lab Libao Jin University of Wyoming May 13, 2020 L. Jin MATH 3341 Built-in ODE Solvers for Stiff/Nonstiff ODEs Nonstiff ODEs Solvers - ode45 , ode23 , and


  1. Lab 14: Built-in ODE Solvers in MATLAB MATH 3341: Introduction to Scientific Computing Lab Libao Jin University of Wyoming May 13, 2020 L. Jin MATH 3341

  2. Built-in ODE Solvers for Stiff/Nonstiff ODEs Nonstiff ODEs Solvers - ode45 , ode23 , and ode113 Lab 14: Built-in ODE Solvers in MATLAB Stiff ODEs Solvers - ode15s , ode23s , ode23t , and ode23tb Fully Implicit ODEs Solvers - ode15i Lab 14: Built-in ODE Solvers in MATLAB L. Jin MATH 3341

  3. Built-in ODE Solvers for Stiff/Nonstiff ODEs Nonstiff ODEs Solvers - ode45 , ode23 , and ode113 Lab 14: Built-in ODE Solvers in MATLAB Stiff ODEs Solvers - ode15s , ode23s , ode23t , and ode23tb Fully Implicit ODEs Solvers - ode15i Built-in ODE Solvers for Stiff/Nonstiff ODEs L. Jin MATH 3341

  4. Built-in ODE Solvers for Stiff/Nonstiff ODEs Nonstiff ODEs Solvers - ode45 , ode23 , and ode113 Lab 14: Built-in ODE Solvers in MATLAB Stiff ODEs Solvers - ode15s , ode23s , ode23t , and ode23tb Fully Implicit ODEs Solvers - ode15i Stiff ODEs Definition A stiff equation is a differential equation for which certain numerical methods for solving the equation are numerically unstable, unless the step size is taken to be extremely small. It has proven difficult to formulate a precise definition of stiffness, but the main idea is that the equation includes some terms that can lead to rapid variation in the solution. L. Jin MATH 3341

  5. Built-in ODE Solvers for Stiff/Nonstiff ODEs Nonstiff ODEs Solvers - ode45 , ode23 , and ode113 Lab 14: Built-in ODE Solvers in MATLAB Stiff ODEs Solvers - ode15s , ode23s , ode23t , and ode23tb Fully Implicit ODEs Solvers - ode15i Choose an ODE Solver Some ODE problems exhibit stiffiness , or difficulty in evaluation. For example, if an ODE has two solution components that vary on drastically different time scales, then the equation might be stiff. You can identify a problem as stiff if nonstiff solvers (such as ode45 ) are unable to solve the problem or are extremly slow. If you observe that a nonstiff solver is very slow, try using a stiff solver such as ode15s instead. When using a stiff solver, you can improve reliability and efficiency by supplying the Jacobian matrix or its sparsity pattern. L. Jin MATH 3341

  6. Built-in ODE Solvers for Stiff/Nonstiff ODEs Nonstiff ODEs Solvers - ode45 , ode23 , and ode113 Lab 14: Built-in ODE Solvers in MATLAB Stiff ODEs Solvers - ode15s , ode23s , ode23t , and ode23tb Fully Implicit ODEs Solvers - ode15i Nonstiff ODEs Solvers - ode45 , ode23 , and ode113 L. Jin MATH 3341

  7. Built-in ODE Solvers for Stiff/Nonstiff ODEs Nonstiff ODEs Solvers - ode45 , ode23 , and ode113 Lab 14: Built-in ODE Solvers in MATLAB Stiff ODEs Solvers - ode15s , ode23s , ode23t , and ode23tb Fully Implicit ODEs Solvers - ode15i ode45 : Solve non-stiff ODEs, medium order method [TOUT,YOUT] = ode45(ODEFUN,TSPAN,Y0) with TSPAN = [T0 TFINAL] integrates the system of differential equations y’ = f(t,y) from time T0 to TFINAL with initial conditions Y0 . ODEFUN is a function handle. To obtain solutions at specific times T0,T1,...,TFINAL (all increasing or all decreasing), use TSPAN = [T0 T1 ... TFINAL] . [TOUT,YOUT] = ode45(ODEFUN,TSPAN,Y0,OPTS) solves as above with default integration properties replaced by values in OPTS , an argument created with the odeset function. SOL = ode45(ODEFUN,[T0 TFINAL],Y0...) returns a structure that can be used with deval to evaluate the solution or its first derivative at any point between T0 and TFINAL . The steps chosen by ode45 are returned in a row vector SOL.x . For each I , the column SOL.y(:,I) contains the solution at SOL.x(I) . L. Jin MATH 3341

  8. Built-in ODE Solvers for Stiff/Nonstiff ODEs Nonstiff ODEs Solvers - ode45 , ode23 , and ode113 Lab 14: Built-in ODE Solvers in MATLAB Stiff ODEs Solvers - ode15s , ode23s , ode23t , and ode23tb Fully Implicit ODEs Solvers - ode15i ode23 : Solve non-stiff ODEs, low order method [TOUT,YOUT] = ode23(ODEFUN,TSPAN,Y0) with TSPAN = [T0 TFINAL] integrates the system of differential equations y’ = f(t,y) from time T0 to TFINAL with initial conditions Y0 . ODEFUN is a function handle. To obtain solutions at specific times T0,T1,...,TFINAL (all increasing or all decreasing), use TSPAN = [T0 T1 ... TFINAL] . [TOUT,YOUT] = ode23(ODEFUN,TSPAN,Y0,OPTS) solves as above with default integration properties replaced by values in OPTS , an argument created with the odeset function. SOL = ode23(ODEFUN,[T0 TFINAL],Y0...) returns a structure that can be used with deval to evaluate the solution or its first derivative at any point between T0 and TFINAL . The steps chosen by ode23 are returned in a row vector SOL.x . For each I , the column SOL.y(:,I) contains the solution at SOL.x(I) . L. Jin MATH 3341

  9. Built-in ODE Solvers for Stiff/Nonstiff ODEs Nonstiff ODEs Solvers - ode45 , ode23 , and ode113 Lab 14: Built-in ODE Solvers in MATLAB Stiff ODEs Solvers - ode15s , ode23s , ode23t , and ode23tb Fully Implicit ODEs Solvers - ode15i ode113 : Solve non-stiff ODEs, variable order method [TOUT,YOUT] = ode113(ODEFUN,TSPAN,Y0) with TSPAN = [T0 TFINAL] integrates the system of differential equations y’ = f(t,y) from time T0 to TFINAL with initial conditions Y0 . ODEFUN is a function handle. To obtain solutions at specific times T0,T1,...,TFINAL (all increasing or all decreasing), use TSPAN = [T0 T1 ... TFINAL] . [TOUT,YOUT] = ode113(ODEFUN,TSPAN,Y0,OPTS) solves as above with default integration properties replaced by values in OPTS , an argument created with the odeset function. SOL = ode113(ODEFUN,[T0 TFINAL],Y0...) returns a structure that can be used with deval to evaluate the solution or its first derivative at any point between T0 and TFINAL . The steps chosen by ode113 are returned in a row vector SOL.x . For each I , the column SOL.y(:,I) contains the solution at SOL.x(I) . L. Jin MATH 3341

  10. Built-in ODE Solvers for Stiff/Nonstiff ODEs Nonstiff ODEs Solvers - ode45 , ode23 , and ode113 Lab 14: Built-in ODE Solvers in MATLAB Stiff ODEs Solvers - ode15s , ode23s , ode23t , and ode23tb Fully Implicit ODEs Solvers - ode15i Stiff ODEs Solvers - ode15s , ode23s , ode23t , and ode23tb L. Jin MATH 3341

  11. Built-in ODE Solvers for Stiff/Nonstiff ODEs Nonstiff ODEs Solvers - ode45 , ode23 , and ode113 Lab 14: Built-in ODE Solvers in MATLAB Stiff ODEs Solvers - ode15s , ode23s , ode23t , and ode23tb Fully Implicit ODEs Solvers - ode15i Fully Implicit ODEs Solvers - ode15i L. Jin MATH 3341

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend