Numerical solution of ODEs

Size: px
Start display at page:

Download "Numerical solution of ODEs"

Transcription

1 Péter Nagy, Csaba Hős H-1111, Budapest, Műegyetem rkp. 3. D building. 3 rd floor Tel: Fax:

2 Table of contents Homework Introduction to Matlab programming Solution of an initial value problem (IVP) Solution of a boundary value problem (BVP)

3 Homework Homework: The homework and these slides will be available on: Submission: Only the source code and the plots have to be archived and submitted to as NC_Name.zip. The subject has to be DENUM NC Name. The deadline is the end of 12 th week. Programming language: Matlab preferred, otherwise personal submission with own laptop is necessary Free alternatives: Octave, Freemat, Scilab

4 Introduction to Matlab programming MATLAB (matrix laboratory) is a multi-paradigm numerical computing environment Current folder! Menu Command window Workspace Text editor Errors, warnings File explorer

5 Useful commands 1. Type stg. + Tab key -> autocomplete F1 key over a function -> Help+description+syntax ; at the end of a command -> the output is not written to the command window clc -> Clear command window clear all -> Delete variables close all -> close figures Avoid overwriting predefined functions and variables (F1 or Tab)!!! Predefined variables: pi, i-imaginary unit, exp(1) Euler number function output = name(var1, var2) global var1 var2 -> define global variables, subfunctions can read them [x1, x2, x3] -> generates a row vector [x1; x2; x3] -> generates a column vector A -> the transpose of A (A can be a matrix or a vector)

6 Useful commands 2 {.+.-.*./} -> calculate {+ - * /} element by element Defining vectors linspace(a, b, n) -> generates linearly spaced vectors between a and b, n is the number of elements a:b generates linearly spaced vectors between a and b, increment is 1 a:deltax:b generates linearly spaced vectors between a and b, increment is deltax v(i) -> the ith element of the vector A(i,j) -> the element of a matrix in the row i and column j A(i,:) -> the i th row of a matrix ; A(:,j) -> the j th column of a matrix Loops for i=1:num_steps end %code %comment while (statement) end %code %comment

7 Useful commands 3 Define functions f(x,y) = Expression can be defined in Matlab f=@(x,y) Expression; -> for simple expression (eg. ODES) or function output = f (x,y) output=expression; -> for longer, more complex calculation (eg. solver) end Important functions [t, y]=ode45(@(t,y) f(y,t), t 0, x 0 ) -> solve ODE (f(y,t)); initial time: t 0 ;initial condition x 0 fminsearch=(@(y) f(y, var1, var2), y 0 ) -> minimize f(y), the initial guess is y 0 Measure computation time (t) tic %code toc (or t=toc)

8 Useful commands 4 Visualization figure(i) -> generates an empty figure, (i is an integer) subplot(n, m, i) -> generates sub figures, n: number of rows, m: num. of columns, i: is the active subplot plot(x,y) -> plot points; x and y are vectors, further possibilities-> F1 in the case of multiple plots plot(x 1,y 1, x 2,y 2, x 3,y 3 ), where x i,y i are vectors title('title') -> generates title legend('title') -> generates title xlabel('label of x axis'), ylabel('label of y axis'), xlim([xmin xmax]), ylim([ymin ymax]) saveas(figure(i), 'name.png') -> save figure(i) as name.png

9 Solution of an IVP

10 Transcript the differential equation The ODE is given 1. If the ODE is higher order transform to first order ODE System Example: t (0) 0 y= f y, ; y y x t c x t s x t g x, t ; x 0 =x ; x 0 =x 0 0 In matrix form: x : y ; x : y x : y ; 1 2 2,, y t c y t sy t g x t y t cy t sy t g x t y= y ; T 1 y2 y1= x y x0 y= t (0) 0 s c y +, ; g y2, t f y y y x 0

11 Example In the case of Van der Pool oscillator x 1 x x x 0; x 0 =x ; x 0 =x y 1 y y y y 1 y y y y y Implemented as VdP_rhs(t,y) in ExpImplEu_VanDerPol_new.m

12 Explicit Euler method 2. Select a solver Explicit Euler method Implemented as y y dt f y n 1 n n n, t

13 Implicit Euler method Implicit Euler method y y dt f y Implemented as n1 n n1 n1 Try to minimize the expression n n1 n1 n1, t y dt f y, t y 0 r y = y dt f y, t y 0 n1 n n1 n1 n1

14 Break

15 Adaptive timestep Problem: Large timestep -> accuracy, stability problems Small timestep -> computationally expensive (=slow) Idea: 1. Predict the local error -> 2. hold between given limits 1. Prediction of the local error Calculate one step in two different ways with different accuracy (but with the same scheme!) The accuracy can be changed: the order of the scheme is changed (ode45) Solve the problem with different stepsize. First, in one step with dt, then in two steps with dt/2

16 Adaptive timestep The error: 1 n1 2 n1 Hold the error between limits y y the less accurate result the more accurate result 2 1 e = y n1 y n1 min, max If the estimated error is too large Else max max do not store the results decrease the timestep dt r dt r<1 new old store the results If the est. error is too small min increase the timestep

17 Adaptive timestep Implemented as:

18 Accuracy of solvers The problem: x t x t 3sin 2t ; x 0 = 2; x 0 = 1 sin y t y t 3 2t 2 1 y1= x y2 y Analytical solution: sin cos sin x t t 2 t 2t

19 Accuracy of solvers

20 Accuracy of solvers

21 Boundary value problem x t y t v g x t 0 0 y t 0 0 y x 1 0 x t vt 0 y t x / v 0 y t 0 1?

22 BVP-Shooting method y t g y t 0 0 y t 0 Solve Implemented as: / D : y t x v D 0 1

23 BVP-Finite differences y t g y t 0 0 y t 1 / v 0 y 2y y y t 2 t yi 1 2yi yi 1 g 2 t i1 i i1 2 yi 1 2yi yi 1 t g 2 1 y y tg y n y n1 1

24 BVP-Finite differences

25 Thank you for your attention!

2D Plotting with Matlab

2D Plotting with Matlab GEEN 1300 Introduction to Engineering Computing Class Meeting #22 Monday, Nov. 9 th Engineering Computing and Problem Solving with Matlab 2-D plotting with Matlab Script files User-defined functions Matlab

More information

Homework 1 Solutions

Homework 1 Solutions 18-9 Signals and Systems Profs. Byron Yu and Pulkit Grover Fall 18 Homework 1 Solutions Part One 1. (8 points) Consider the DT signal given by the algorithm: x[] = 1 x[1] = x[n] = x[n 1] x[n ] (a) Plot

More information

Matlab Section. November 8, 2005

Matlab Section. November 8, 2005 Matlab Section November 8, 2005 1 1 General commands Clear all variables from memory : clear all Close all figure windows : close all Save a variable in.mat format : save filename name of variable Load

More information

Numerical Methods - Boundary Value Problems for ODEs

Numerical Methods - Boundary Value Problems for ODEs Numerical Methods - Boundary Value Problems for ODEs Y. K. Goh Universiti Tunku Abdul Rahman 2013 Y. K. Goh (UTAR) Numerical Methods - Boundary Value Problems for ODEs 2013 1 / 14 Outline 1 Boundary Value

More information

LAB 1: MATLAB - Introduction to Programming. Objective:

LAB 1: MATLAB - Introduction to Programming. Objective: LAB 1: MATLAB - Introduction to Programming Objective: The objective of this laboratory is to review how to use MATLAB as a programming tool and to review a classic analytical solution to a steady-state

More information

System Simulation using Matlab

System Simulation using Matlab EE4314 Fall 2008 System Simulation using Matlab The purpose of this laboratory work is to provide experience with the Matlab software for system simulation. The laboratory work contains a guide for solving

More information

Mon Jan Improved acceleration models: linear and quadratic drag forces. Announcements: Warm-up Exercise:

Mon Jan Improved acceleration models: linear and quadratic drag forces. Announcements: Warm-up Exercise: Math 2250-004 Week 4 notes We will not necessarily finish the material from a given day's notes on that day. We may also add or subtract some material as the week progresses, but these notes represent

More information

Matlab for Review. NDSU Matlab Review pg 1

Matlab for Review. NDSU Matlab Review pg 1 NDSU Matlab Review pg 1 Becoming familiar with MATLAB The console The editor The graphics windows The help menu Saving your data (diary) General environment and the console Matlab for Review Simple numerical

More information

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP In this laboratory session we will learn how to. Use MATLAB solvers for solving scalar IVP 2. Use MATLAB solvers for solving higher order ODEs and

More information

We begin exploring Euler s method by looking at direction fields. Consider the direction field below.

We begin exploring Euler s method by looking at direction fields. Consider the direction field below. Emma Reid- MA 66, Lesson 9 (SU 17) Euler s Method (.7) So far in this course, we have seen some very special types of first order ODEs. We ve seen methods to solve linear, separable, homogeneous, Bernoulli,

More information

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP MAT 75 Laboratory 4 MATLAB solvers for First-Order IVP In this laboratory session we will learn how to. Use MATLAB solvers for solving scalar IVP. Use MATLAB solvers for solving higher order ODEs and systems

More information

Introduction to MatLab

Introduction to MatLab Introduction to MatLab 1 Introduction to MatLab Graduiertenkolleg Kognitive Neurobiologie Friday, 05 November 2004 Thuseday, 09 Novemer 2004 Kurt Bräuer Institut für Theoretische Physik, Universität Tübingen

More information

NUMERICAL METHODS. lor CHEMICAL ENGINEERS. Using Excel', VBA, and MATLAB* VICTOR J. LAW. CRC Press. Taylor & Francis Group

NUMERICAL METHODS. lor CHEMICAL ENGINEERS. Using Excel', VBA, and MATLAB* VICTOR J. LAW. CRC Press. Taylor & Francis Group NUMERICAL METHODS lor CHEMICAL ENGINEERS Using Excel', VBA, and MATLAB* VICTOR J. LAW CRC Press Taylor & Francis Group Boca Raton London New York CRC Press is an imprint of the Taylor & Francis Croup,

More information

Practical Course Scientific Computing and Visualization

Practical Course Scientific Computing and Visualization Technische Universität München WT 007/00 Institut für Informatik Dr. Miriam Mehl Tobias Weinzierl Csaba Vigh Practical Course Scientific Computing and Visualization Worksheet distributed: 07..007 due to:

More information

Octave. Tutorial. Daniel Lamprecht. March 26, Graz University of Technology. Slides based on previous work by Ingo Holzmann

Octave. Tutorial. Daniel Lamprecht. March 26, Graz University of Technology. Slides based on previous work by Ingo Holzmann Tutorial Graz University of Technology March 26, 2012 Slides based on previous work by Ingo Holzmann Introduction What is? GNU is a high-level interactive language for numerical computations mostly compatible

More information

Introduction to Computational Neuroscience

Introduction to Computational Neuroscience CSE2330 Introduction to Computational Neuroscience Basic computational tools and concepts Tutorial 1 Duration: two weeks 1.1 About this tutorial The objective of this tutorial is to introduce you to: the

More information

The Plan. Initial value problems (ivps) for ordinary differential equations (odes) Review of basic methods You are here: Hamiltonian systems

The Plan. Initial value problems (ivps) for ordinary differential equations (odes) Review of basic methods You are here: Hamiltonian systems Scientific Computing with Case Studies SIAM Press, 2009 http://www.cs.umd.edu/users/oleary/sccswebpage Lecture Notes for Unit V Solution of Differential Equations Part 2 Dianne P. O Leary c 2008 The Plan

More information

Simulink Tutorial 1 CPE562

Simulink Tutorial 1 CPE562 Simulink Tutorial 1 CPE562 Week 1 Introduction to Simulink Familiarization with Simulink blocks Sources: Constants Sinks: Display Operations: Sum, Product, Add, Divide. Mathematical operations involving

More information

EE 4314 Lab 1 Handout Control Systems Simulation with MATLAB and SIMULINK Spring Lab Information

EE 4314 Lab 1 Handout Control Systems Simulation with MATLAB and SIMULINK Spring Lab Information EE 4314 Lab 1 Handout Control Systems Simulation with MATLAB and SIMULINK Spring 2013 1. Lab Information This is a take-home lab assignment. There is no experiment for this lab. You will study the tutorial

More information

APPLICATIONS OF FD APPROXIMATIONS FOR SOLVING ORDINARY DIFFERENTIAL EQUATIONS

APPLICATIONS OF FD APPROXIMATIONS FOR SOLVING ORDINARY DIFFERENTIAL EQUATIONS LECTURE 10 APPLICATIONS OF FD APPROXIMATIONS FOR SOLVING ORDINARY DIFFERENTIAL EQUATIONS Ordinary Differential Equations Initial Value Problems For Initial Value problems (IVP s), conditions are specified

More information

MTH 452/552 Homework 3

MTH 452/552 Homework 3 MTH 452/552 Homework 3 Do either 1 or 2. 1. (40 points) [Use of ode113 and ode45] This problem can be solved by a modifying the m-files odesample.m and odesampletest.m available from the author s webpage.

More information

1. Open polymath: 2. Go to Help, Contents F1 or Press F1

1. Open polymath: 2. Go to Help, Contents F1 or Press F1 Polymath Tutorial Process Fluid Transport 1. Open polymath: 2. Go to Help, Contents F1 or Press F1 1 3. Read the section titled Introduction to Polymath both getting started and Variables and expressions

More information

Integration by Parts Logarithms and More Riemann Sums!

Integration by Parts Logarithms and More Riemann Sums! Integration by Parts Logarithms and More Riemann Sums! James K. Peterson Department of Biological Sciences and Department of Mathematical Sciences Clemson University September 16, 2013 Outline 1 IbyP with

More information

EGR 140 Lab 6: Functions and Function Files Topics to be covered : Practice :

EGR 140 Lab 6: Functions and Function Files Topics to be covered : Practice : EGR 140 Lab 6: Functions and Function Files Topics to be covered : Creating a Function File Structure of a Function File Function Definition Line Input and Output Arguments Function Body Local and Global

More information

Ordinary Differential Equations (ode)

Ordinary Differential Equations (ode) Ordinary Differential Equations (ode) Numerical Methods for Solving Initial condition (ic) problems and Boundary value problems (bvp) What is an ODE? =,,...,, yx, dx dx dx dx n n 1 n d y d y d y In general,

More information

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP MATLAB sessions: Laboratory 4 MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP In this laboratory session we will learn how to. Use MATLAB solvers for solving scalar IVP 2. Use MATLAB solvers for

More information

Wed Jan Improved Euler and Runge Kutta. Announcements: Warm-up Exercise:

Wed Jan Improved Euler and Runge Kutta. Announcements: Warm-up Exercise: Wed Jan 31 2.5-2.6 Improved Euler and Runge Kutta. Announcements: Warm-up Eercise: 2.5-2.6 Improved Euler and Runge Kutta In more complicated differential equations it is a very serious issue to find relatively

More information

Solving Linear Systems of ODEs with Matlab

Solving Linear Systems of ODEs with Matlab Solving Linear Systems of ODEs with Matlab James K. Peterson Department of Biological Sciences and Department of Mathematical Sciences Clemson University October 27, 2013 Outline Linear Systems Numerically

More information

An Introduction to MatLab

An Introduction to MatLab Introduction to MatLab 1 An Introduction to MatLab Contents 1. Starting MatLab... 3 2. Workspace and m-files... 4 3. Help... 5 4. Vectors and Matrices... 5 5. Objects... 8 6. Plots... 10 7. Statistics...

More information

Mon Jan Improved acceleration models: linear and quadratic drag forces. Announcements: Warm-up Exercise:

Mon Jan Improved acceleration models: linear and quadratic drag forces. Announcements: Warm-up Exercise: Math 2250-004 Week 4 notes We will not necessarily finish the material from a given day's notes on that day. We may also add or subtract some material as the week progresses, but these notes represent

More information

Matlab homework assignments for modeling dynamical systems

Matlab homework assignments for modeling dynamical systems Physics 311 Analytical Mechanics - Matlab Exercises C1.1 Matlab homework assignments for modeling dynamical systems Physics 311 - Analytical Mechanics Professor Bruce Thompson Department of Physics Ithaca

More information

Computer lab for MAN460

Computer lab for MAN460 Computer lab for MAN460 (version 20th April 2006, corrected 20 May) Prerequisites Matlab is rather user friendly, and to do the first exercises, it is enough to write an m-file consisting of two lines,

More information

Read through A Graphing Checklist for Physics Graduate Students before submitting any plots in this module. See the course website for the link.

Read through A Graphing Checklist for Physics Graduate Students before submitting any plots in this module. See the course website for the link. Module C2: MatLab The Physics and Astronomy Department has several copies of MATLAB installed on computers that can be accessed by students. MATLAB is a highly developed software package that allows the

More information

Graded Project #1. Part 1. Explicit Runge Kutta methods. Goals Differential Equations FMN130 Gustaf Söderlind and Carmen Arévalo

Graded Project #1. Part 1. Explicit Runge Kutta methods. Goals Differential Equations FMN130 Gustaf Söderlind and Carmen Arévalo 2008-11-07 Graded Project #1 Differential Equations FMN130 Gustaf Söderlind and Carmen Arévalo This homework is due to be handed in on Wednesday 12 November 2008 before 13:00 in the post box of the numerical

More information

Ordinary Differential equations

Ordinary Differential equations Chapter 1 Ordinary Differential equations 1.1 Introduction to Ordinary Differential equation In mathematics, an ordinary differential equation (ODE) is an equation which contains functions of only one

More information

January 18, 2008 Steve Gu. Reference: Eta Kappa Nu, UCLA Iota Gamma Chapter, Introduction to MATLAB,

January 18, 2008 Steve Gu. Reference: Eta Kappa Nu, UCLA Iota Gamma Chapter, Introduction to MATLAB, Introduction to MATLAB January 18, 2008 Steve Gu Reference: Eta Kappa Nu, UCLA Iota Gamma Chapter, Introduction to MATLAB, Part I: Basics MATLAB Environment Getting Help Variables Vectors, Matrices, and

More information

EEE161 Applied Electromagnetics Laboratory 1

EEE161 Applied Electromagnetics Laboratory 1 Dr. Milica Marković Applied Electromagnetics Laboratory page 1 EEE161 Applied Electromagnetics Laboratory 1 Instructor: Dr. Milica Marković Office: Riverside Hall 3028 Email: milica@csus.edu Web:http://gaia.ecs.csus.edu/

More information

AMS 27L LAB #8 Winter 2009

AMS 27L LAB #8 Winter 2009 AMS 27L LAB #8 Winter 29 Solving ODE s in Matlab Objectives:. To use Matlab s ODE Solvers 2. To practice using functions and in-line functions Matlab s ODE Suite Matlab offers a suite of ODE solvers including:

More information

Statistical methods. Mean value and standard deviations Standard statistical distributions Linear systems Matrix algebra

Statistical methods. Mean value and standard deviations Standard statistical distributions Linear systems Matrix algebra Statistical methods Mean value and standard deviations Standard statistical distributions Linear systems Matrix algebra Statistical methods Generating random numbers MATLAB has many built-in functions

More information

Understand the existence and uniqueness theorems and what they tell you about solutions to initial value problems.

Understand the existence and uniqueness theorems and what they tell you about solutions to initial value problems. Review Outline To review for the final, look over the following outline and look at problems from the book and on the old exam s and exam reviews to find problems about each of the following topics.. Basics

More information

Introduction to MATLAB Practical 2

Introduction to MATLAB Practical 2 Introduction to MATLAB Practical 2 Daniel Carrera November 2016 1 Searching through data One of the most important skills in scientific computing is sorting through large datasets and extracting the information

More information

Initial value problems for ordinary differential equations

Initial value problems for ordinary differential equations AMSC/CMSC 660 Scientific Computing I Fall 2008 UNIT 5: Numerical Solution of Ordinary Differential Equations Part 1 Dianne P. O Leary c 2008 The Plan Initial value problems (ivps) for ordinary differential

More information

25 Self-Assessment. 26 Eigenvalue Stability for a Linear ODE. Chapter 7 Eigenvalue Stability

25 Self-Assessment. 26 Eigenvalue Stability for a Linear ODE. Chapter 7 Eigenvalue Stability Chapter 7 Eigenvalue Stability As we have seen, while numerical methods can be convergent, they can still exhibit instabilities as the number of timesteps n increases for finite t. For example, when applying

More information

Lecture 7 Symbolic Computations

Lecture 7 Symbolic Computations Lecture 7 Symbolic Computations The focus of this course is on numerical computations, i.e. calculations, usually approximations, with floating point numbers. However, Matlab can also do symbolic computations,

More information

The Euler Method for the Initial Value Problem

The Euler Method for the Initial Value Problem The Euler Method for the Initial Value Problem http://people.sc.fsu.edu/ jburkardt/isc/week10 lecture 18.pdf... ISC3313: Introduction to Scientific Computing with C++ Summer Semester 2011... John Burkardt

More information

Part 1. The diffusion equation

Part 1. The diffusion equation Differential Equations FMNN10 Graded Project #3 c G Söderlind 2016 2017 Published 2017-11-27. Instruction in computer lab 2017-11-30/2017-12-06/07. Project due date: Monday 2017-12-11 at 12:00:00. Goals.

More information

WILEY. Differential Equations with MATLAB (Third Edition) Brian R. Hunt Ronald L. Lipsman John E. Osborn Jonathan M. Rosenberg

WILEY. Differential Equations with MATLAB (Third Edition) Brian R. Hunt Ronald L. Lipsman John E. Osborn Jonathan M. Rosenberg Differential Equations with MATLAB (Third Edition) Updated for MATLAB 2011b (7.13), Simulink 7.8, and Symbolic Math Toolbox 5.7 Brian R. Hunt Ronald L. Lipsman John E. Osborn Jonathan M. Rosenberg All

More information

Lecture 17: Ordinary Differential Equation II. First Order (continued)

Lecture 17: Ordinary Differential Equation II. First Order (continued) Lecture 17: Ordinary Differential Equation II. First Order (continued) 1. Key points Maple commands dsolve dsolve[interactive] dsolve(numeric) 2. Linear first order ODE: y' = q(x) - p(x) y In general,

More information

Lecture 5b: Starting Matlab

Lecture 5b: Starting Matlab Lecture 5b: Starting Matlab James K. Peterson Department of Biological Sciences and Department of Mathematical Sciences Clemson University August 7, 2013 Outline 1 Resources 2 Starting Matlab 3 Homework

More information

Solutions to Homework 3

Solutions to Homework 3 Solutions to Homework 3 Section 3.4, Repeated Roots; Reduction of Order Q 1). Find the general solution to 2y + y = 0. Answer: The charactertic equation : r 2 2r + 1 = 0, solving it we get r = 1 as a repeated

More information

An Overly Simplified and Brief Review of Differential Equation Solution Methods. 1. Some Common Exact Solution Methods for Differential Equations

An Overly Simplified and Brief Review of Differential Equation Solution Methods. 1. Some Common Exact Solution Methods for Differential Equations An Overly Simplified and Brief Review of Differential Equation Solution Methods We will be dealing with initial or boundary value problems. A typical initial value problem has the form y y 0 y(0) 1 A typical

More information

MATLAB crash course 1 / 27. MATLAB crash course. Cesar E. Tamayo Economics - Rutgers. September 27th, /27

MATLAB crash course 1 / 27. MATLAB crash course. Cesar E. Tamayo Economics - Rutgers. September 27th, /27 1/27 MATLAB crash course 1 / 27 MATLAB crash course Cesar E. Tamayo Economics - Rutgers September 27th, 2013 2/27 MATLAB crash course 2 / 27 Program Program I Interface: layout, menus, help, etc.. I Vectors

More information

Scientific Computing with Case Studies SIAM Press, Lecture Notes for Unit V Solution of

Scientific Computing with Case Studies SIAM Press, Lecture Notes for Unit V Solution of Scientific Computing with Case Studies SIAM Press, 2009 http://www.cs.umd.edu/users/oleary/sccswebpage Lecture Notes for Unit V Solution of Differential Equations Part 1 Dianne P. O Leary c 2008 1 The

More information

JMBC Computational Fluid Dynamics I Exercises by A.E.P. Veldman

JMBC Computational Fluid Dynamics I Exercises by A.E.P. Veldman JMBC Computational Fluid Dynamics I Exercises by A.E.P. Veldman The exercises will be carried out on PC s in the practicum rooms. Several (Matlab and Fortran) files are required. How these can be obtained

More information

Example 1 (Characteristic Equation, Eigenvalue, and Eigenvector)

Example 1 (Characteristic Equation, Eigenvalue, and Eigenvector) Matlab Lab 3 Example 1 (Characteristic Equation, Eigenvalue, and Eigenvector) A polynomial equation is uniquely determined by the coefficients of the monomial terms. For example, the quadratic equation

More information

MATH2071: LAB 3: Implicit ODE methods

MATH2071: LAB 3: Implicit ODE methods MATH2071: LAB 3: Implicit ODE methods 1 Introduction Introduction Exercise 1 Stiff Systems Exercise 2 Direction Field Plots Exercise 3 The Backward Euler Method Exercise 4 Newton s method Exercise 5 The

More information

. var save filename var. y fprintf(fl,'%f %f\n',y) y ..TXT. . fprintf() .TXT. myf = fopen('nam.txt','w'); nam.txt myf.

. var save filename var. y fprintf(fl,'%f %f\n',y) y ..TXT. . fprintf() .TXT. myf = fopen('nam.txt','w'); nam.txt myf. y fprintf(fl,'%f %f\n',y) y. \n.txt. fprintf()..txt.. myf = fopen('nam.txt','w'); :. (1-4 )..TXT. % Optt.m av =[17.4537 4.57 15.3 17.869 3.7]; Tit = 'Students Average:'; myf = fopen('nam.txt','w'); fprintf(myf,'%s\n',tit);

More information

Math 98 - Introduction to MATLAB Programming. Spring Lecture 3

Math 98 - Introduction to MATLAB Programming. Spring Lecture 3 Reminders Instructor: Chris Policastro Class Website: https://math.berkeley.edu/~cpoli/math98/fall2016.html Assignment Submission: https://bcourses.berkeley.edu Homework 2 1 Due September 8th by 11:59pm

More information

ODE Homework 1. Due Wed. 19 August 2009; At the beginning of the class

ODE Homework 1. Due Wed. 19 August 2009; At the beginning of the class ODE Homework Due Wed. 9 August 2009; At the beginning of the class. (a) Solve Lẏ + Ry = E sin(ωt) with y(0) = k () L, R, E, ω are positive constants. (b) What is the limit of the solution as ω 0? (c) Is

More information

Finite Difference Method

Finite Difference Method Finite Difference Method for BVP ODEs Dec 3, 2014 1 Recall An ordinary differential equation is accompanied by auxiliary conditions. In the analytical method, these conditions are used to evaluate the

More information

Lecture 8: Calculus and Differential Equations

Lecture 8: Calculus and Differential Equations Lecture 8: Calculus and Differential Equations Dr. Mohammed Hawa Electrical Engineering Department University of Jordan EE201: Computer Applications. See Textbook Chapter 9. Numerical Methods MATLAB provides

More information

Lecture 8: Calculus and Differential Equations

Lecture 8: Calculus and Differential Equations Lecture 8: Calculus and Differential Equations Dr. Mohammed Hawa Electrical Engineering Department University of Jordan EE21: Computer Applications. See Textbook Chapter 9. Numerical Methods MATLAB provides

More information

Lab 4 Numerical simulation of a crane

Lab 4 Numerical simulation of a crane Lab 4 Numerical simulation of a crane Agenda Time 10 min Item Review agenda Introduce the crane problem 95 min Lab activity I ll try to give you a 5- minute warning before the end of the lab period to

More information

Modeling and Solving Constraints. Erin Catto Blizzard Entertainment

Modeling and Solving Constraints. Erin Catto Blizzard Entertainment Modeling and Solving Constraints Erin Catto Blizzard Entertainment Basic Idea Constraints are used to simulate joints, contact, and collision. We need to solve the constraints to stack boxes and to keep

More information

1 TIME OF ARRIVAL LOCATION TECHNIQUE

1 TIME OF ARRIVAL LOCATION TECHNIQUE Contents 1 TIME OF ARRIVAL LOCATION TECHNIQUE 2 1.1 TOA Principals...................................... 2 1.2 Time of Arrival Location Error Analysis........................ 8 1.3 Determining the Best

More information

MATLAB Project 2: MATH240, Spring 2013

MATLAB Project 2: MATH240, Spring 2013 1. Method MATLAB Project 2: MATH240, Spring 2013 This page is more information which can be helpful for your MATLAB work, including some new commands. You re responsible for knowing what s been done before.

More information

CHEE 222: PROCESS DYNAMICS AND NUMERICAL METHODS

CHEE 222: PROCESS DYNAMICS AND NUMERICAL METHODS CHEE 222: PROCESS DYNAMICS AND NUMERICAL METHODS Winter 2017 Implementation of Numerical Methods via MATLAB Instructor: Xiang Li 1 Outline 1. Introduction - Command, script and function - MATLAB function

More information

ENED 1091 HW#3 Due Week of February 22 nd

ENED 1091 HW#3 Due Week of February 22 nd ENED 1091 HW#3 Due Week of February 22 nd Problem 1: The graph below shows position measurements (in cm) collected every 0.5 seconds over a 10 second interval of time. (a) Using linear interpolation, estimate

More information

Polytechnic Institute of NYU MA 2132 Final Practice Answers Fall 2012

Polytechnic Institute of NYU MA 2132 Final Practice Answers Fall 2012 Polytechnic Institute of NYU MA Final Practice Answers Fall Studying from past or sample exams is NOT recommended. If you do, it should be only AFTER you know how to do all of the homework and worksheet

More information

I. Numerical Computing

I. Numerical Computing I. Numerical Computing A. Lectures 1-3: Foundations of Numerical Computing Lecture 1 Intro to numerical computing Understand difference and pros/cons of analytical versus numerical solutions Lecture 2

More information

Lecture 4. Programming

Lecture 4. Programming Lecture 4 Advanced Matlab Programming Announcements Hands-on Session on Friday 1318 EB Read Chapters 3-6 in your MATLAB book HW 2 opens up Friday evening Today Numerical analysis - I Visualization I Some

More information

The family of Runge Kutta methods with two intermediate evaluations is defined by

The family of Runge Kutta methods with two intermediate evaluations is defined by AM 205: lecture 13 Last time: Numerical solution of ordinary differential equations Today: Additional ODE methods, boundary value problems Thursday s lecture will be given by Thomas Fai Assignment 3 will

More information

10.34 Numerical Methods Applied to Chemical Engineering Fall Homework #4: IVP

10.34 Numerical Methods Applied to Chemical Engineering Fall Homework #4: IVP 10.34 Numerical Methods Applied to Chemical Engineering Fall 015 Homework #4: IVP Problem 1 (0 points). In this problem you will develop and implement an ODE solver for problems of the form dy = f(y) dt

More information

Differential Equations FMNN10 Graded Project #1 c G Söderlind 2017

Differential Equations FMNN10 Graded Project #1 c G Söderlind 2017 Differential Equations FMNN10 Graded Project #1 c G Söderlind 2017 Published 2017-10-30. Instruction in computer lab 2017-11-02/08/09. Project report due date: Monday 2017-11-13 at 10:00. Goals. The goal

More information

Conformational Analysis of n-butane

Conformational Analysis of n-butane Conformational Analysis of n-butane In this exercise you will calculate the Molecular Mechanics (MM) single point energy of butane in various conformations with respect to internal rotation around the

More information

Temperature measurement

Temperature measurement Luleå University of Technology Johan Carlson Last revision: July 22, 2009 Measurement Technology and Uncertainty Analysis - E7021E Lab 3 Temperature measurement Introduction In this lab you are given a

More information

Riemann Integration. James K. Peterson. February 2, Department of Biological Sciences and Department of Mathematical Sciences Clemson University

Riemann Integration. James K. Peterson. February 2, Department of Biological Sciences and Department of Mathematical Sciences Clemson University Riemann Integration James K. Peterson Department of Biological Sciences and Department of Mathematical Sciences Clemson University February 2, 2017 Outline 1 Riemann Sums 2 Riemann Sums In MatLab 3 Graphing

More information

1 Introduction to MATLAB

1 Introduction to MATLAB L3 - December 015 Solving PDEs numerically (Reports due Thursday Dec 3rd, carolinemuller13@gmail.com) In this project, we will see various methods for solving Partial Differential Equations (PDEs) using

More information

1 Some general theory for 2nd order linear nonhomogeneous

1 Some general theory for 2nd order linear nonhomogeneous Math 175 Honors ODE I Spring, 013 Notes 5 1 Some general theory for nd order linear nonhomogeneous equations 1.1 General form of the solution Suppose that p; q; and g are continuous on an interval I; and

More information

(6.2) -The Shooting Method for Nonlinear Problems

(6.2) -The Shooting Method for Nonlinear Problems (6.2) -The Shooting Method for Nonlinear Problems Consider the boundary value problems (BVPs) for the second order differential equation of the form (*) y f x,y,y, a x b, y a and y b. When f x,y,y is linear

More information

Ordinary Differential Equations. Monday, October 10, 11

Ordinary Differential Equations. Monday, October 10, 11 Ordinary Differential Equations Monday, October 10, 11 Problems involving ODEs can always be reduced to a set of first order differential equations. For example, By introducing a new variable z, this can

More information

Additional Homework Problems

Additional Homework Problems Additional Homework Problems These problems supplement the ones assigned from the text. Use complete sentences whenever appropriate. Use mathematical terms appropriately. 1. What is the order of a differential

More information

Math 515 Fall, 2008 Homework 2, due Friday, September 26.

Math 515 Fall, 2008 Homework 2, due Friday, September 26. Math 515 Fall, 2008 Homework 2, due Friday, September 26 In this assignment you will write efficient MATLAB codes to solve least squares problems involving block structured matrices known as Kronecker

More information

Athena Visual Software, Inc. 1

Athena Visual Software, Inc. 1 Athena Visual Studio Visual Kinetics Tutorial VisualKinetics is an integrated tool within the Athena Visual Studio software environment, which allows scientists and engineers to simulate the dynamic behavior

More information

Homework #6 Solutions

Homework #6 Solutions Problems Section.1: 6, 4, 40, 46 Section.:, 8, 10, 14, 18, 4, 0 Homework #6 Solutions.1.6. Determine whether the functions f (x) = cos x + sin x and g(x) = cos x sin x are linearly dependent or linearly

More information

ENGR Spring Exam 2

ENGR Spring Exam 2 ENGR 1300 Spring 013 Exam INSTRUCTIONS: Duration: 60 minutes Keep your eyes on your own work! Keep your work covered at all times! 1. Each student is responsible for following directions. Read carefully..

More information

10. Linear Systems of ODEs, Matrix multiplication, superposition principle (parts of sections )

10. Linear Systems of ODEs, Matrix multiplication, superposition principle (parts of sections ) c Dr. Igor Zelenko, Fall 2017 1 10. Linear Systems of ODEs, Matrix multiplication, superposition principle (parts of sections 7.2-7.4) 1. When each of the functions F 1, F 2,..., F n in right-hand side

More information

Homework Assignment 4 Root Finding Algorithms The Maximum Velocity of a Car Due: Friday, February 19, 2010 at 12noon

Homework Assignment 4 Root Finding Algorithms The Maximum Velocity of a Car Due: Friday, February 19, 2010 at 12noon ME 2016 A Spring Semester 2010 Computing Techniques 3-0-3 Homework Assignment 4 Root Finding Algorithms The Maximum Velocity of a Car Due: Friday, February 19, 2010 at 12noon Description and Outcomes In

More information

Chemical Engineering 436 Laplace Transforms (1)

Chemical Engineering 436 Laplace Transforms (1) Chemical Engineering 436 Laplace Transforms () Why Laplace Transforms?? ) Converts differential equations to algebraic equations- facilitates combination of multiple components in a system to get the total

More information

HOMEWORK 3: Phase portraits for Mathmatical Models, Analysis and Simulation, Fall 2010 Report due Mon Oct 4, Maximum score 7.0 pts.

HOMEWORK 3: Phase portraits for Mathmatical Models, Analysis and Simulation, Fall 2010 Report due Mon Oct 4, Maximum score 7.0 pts. HOMEWORK 3: Phase portraits for Mathmatical Models, Analysis and Simulation, Fall 2010 Report due Mon Oct 4, 2010. Maximum score 7.0 pts. Three problems are to be solved in this homework assignment. The

More information

Companion. Jeffrey E. Jones

Companion. Jeffrey E. Jones MATLAB7 Companion 1O11OO1O1O1OOOO1O1OO1111O1O1OO 1O1O1OO1OO1O11OOO1O111O1O1O1O1 O11O1O1O11O1O1O1O1OO1O11O1O1O1 O1O1O1111O11O1O1OO1O1O1O1OOOOO O1111O1O1O1O1O1O1OO1OO1OO1OOO1 O1O11111O1O1O1O1O Jeffrey E.

More information

Assignment 6, Math 575A

Assignment 6, Math 575A Assignment 6, Math 575A Part I Matlab Section: MATLAB has special functions to deal with polynomials. Using these commands is usually recommended, since they make the code easier to write and understand

More information

Lecture 3: Special Matrices

Lecture 3: Special Matrices Lecture 3: Special Matrices Feedback of assignment1 Random matrices The magic matrix commend magic() doesn t give us random matrix. Random matrix means we will get different matrices each time when we

More information

Numerical Methods for Embedded Optimization and Optimal Control. Exercises

Numerical Methods for Embedded Optimization and Optimal Control. Exercises Summer Course Numerical Methods for Embedded Optimization and Optimal Control Exercises Moritz Diehl, Daniel Axehill and Lars Eriksson June 2011 Introduction This collection of exercises is intended to

More information

Riemann Integration. Outline. James K. Peterson. February 2, Riemann Sums. Riemann Sums In MatLab. Graphing Riemann Sums

Riemann Integration. Outline. James K. Peterson. February 2, Riemann Sums. Riemann Sums In MatLab. Graphing Riemann Sums Riemann Integration James K. Peterson Department of Biological Sciences and Department of Mathematical Sciences Clemson University February 2, 2017 Outline Riemann Sums Riemann Sums In MatLab Graphing

More information

2 Getting Started with Numerical Computations in Python

2 Getting Started with Numerical Computations in Python 1 Documentation and Resources * Download: o Requirements: Python, IPython, Numpy, Scipy, Matplotlib o Windows: google "windows download (Python,IPython,Numpy,Scipy,Matplotlib" o Debian based: sudo apt-get

More information

Differential equations and numerical methods / M.E. Mincsovics

Differential equations and numerical methods / M.E. Mincsovics General information: You can use any help possible when solving the programming tasks. Every correct answer is 5 points. Everybody has a number, you can find it in the first column of the table. Convert

More information

2007 Summer College on Plasma Physics

2007 Summer College on Plasma Physics 1856-18 2007 Summer College on Plasma Physics 30 July - 24 August, 2007 Numerical methods and simulations. Lecture 2: Simulation of ordinary differential equations. B. Eliasson Institut fur Theoretische

More information

Chemical reaction networks and diffusion

Chemical reaction networks and diffusion FYTN05 Computer Assignment 2 Chemical reaction networks and diffusion Supervisor: Adriaan Merlevede Office: K336-337, E-mail: adriaan@thep.lu.se 1 Introduction This exercise focuses on understanding and

More information

MATLAB BASICS. Instructor: Prof. Shahrouk Ahmadi. TA: Kartik Bulusu

MATLAB BASICS. Instructor: Prof. Shahrouk Ahmadi. TA: Kartik Bulusu MATLAB BASICS Instructor: Prof. Shahrouk Ahmadi 1. What are M-files TA: Kartik Bulusu M-files are files that contain a collection of MATLAB commands or are used to define new MATLAB functions. For the

More information