Unformatted text preview:

MATH 282 MATLAB Assignment 3 Numerical Solutions the MATLAB Command ode45 So far we have been using examples where the command dsolve was capable of producing explicit solutions of the differential equations Now consider the IVP y y y2 0 2sin t y 0 2 If we type In this situation we use the numerical solver ode45 to find and plot approximate solutions for the equation First we define an anonymous function we could use an inline function We will use the notation yap instead of y just to emphasis that the solution is an approximation one We solved the IVP over the interval 0 15 with initial condition y 0 2 Notice the way the second and third arguments were used with the command ode45 In particular 0 must be one of end points of the interval over which we wish to obtain a solution If we wish to plot the same solution solution on the interval 2 15 then we plot forwards i e over 0 15 and backwards i e over 0 2 Now suppose we want to plot a family of solutions with initial values y 0 0 1 0 3 0 5 1 2 over the interval 0 15 then Similarly we can plot the entire family on the interval 2 15 by solving forwards and backwards Remark The choice of axis is very important in producing a complete graph Example Consider the initial value problem y y y2 0 2sin t y 7 0 5 Use ode45 to find an approximate solution over the interval 0 15 Plot the approximate solution together with an appropriate slope field Exercise y Consider the differential equation y t a Use ode45 to calculate and plot an approximate solution to the initial value y 0 1 for 0 t 2 problem y t y b Use dsolve to find an exact solution of the IVP c Plot the exact and the approximate solution on the same graph Can you distinguish between the two curves d Plot a family of solutions with initial values y 0 1 2 1 4 1 6 1 8 over the interval 1 2


View Full Document

MC MATH 282 - MATLAB Assignment 3

Documents in this Course
Load more
Download MATLAB Assignment 3
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view MATLAB Assignment 3 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view MATLAB Assignment 3 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?