Initial value problems, math, Mathematics

Write a Matlab function MyIVP that solves an initial-value problem (IVP) for a system of ordinary
differential equations (ODEs) of the form
x ?(t) = f (t, x(t)),
where f : R × Rn ? Rn is an arbitrary function with one one-dimensional input (for time t) and one n-dimensional input x, and n-dimensional output. The function should implement a Runge-Kutta formula (for example, the rk34 formula or the Dormand & Prince formula).
The initial value x0 is provided by the user of MyIVP. The first line of MyIVP (saved in a file MyIVP.m) should look like this
function [xend,t,xt]=MyIVP(f,x0,tspan,N) Inputs
• f: function defining the right-hand side of the ODE. f should accept two arguments: t (a number) and x (an n-dimensional vector). The function f should return an n-dimensional vector y (the time derivative). Typical calling sequence: y=f(t,x), returning the value of f at time t in position x.
• x0: initial value where integration starts from (n-dimensional vector).
• tspan: Starting time and end time for integration. Integration has to run from time t =tspan(1)
to time t =tspan(2).
• N: number of steps for integration. The integration stepsize h=(tspan(2)-tspan(1))/N should
be small.
• xend: result of integration at t =tspan(2).
• t: vector of times at which intermediate values have been computed (this should have N + 1
• xt: intermediate values (n × (N + 1)-array). xt(:,k) should be the solution at t(k).
You can check the built-in variable nargout inside your function to see if the user wants to get three outputs or only the end value xend. If nargout==1 you don’t need to store the intermediate values.
Posted Date: 3/12/2012 10:19:33 AM | Location : United States

Related Discussions:- Initial value problems, math, Assignment Help, Ask Question on Initial value problems, math, Get Answer, Expert's Help, Initial value problems, math Discussions

Write discussion on Initial value problems, math
Your posts are moderated
Related Questions
A payday loan company charges a $95 fee for a $500 payday loan that will be repaid in 11 days. Treating the fee as interest paid, what is the equivalent annual interest rate?

Evaluate the given limits, showing all working: Using first principles (i.e. the method used in Example 1, Washington 2009, Using definition to find derivative ) find the

how can a curve be divided in three equal part?

HOW MANY number laying between 100 and 1000 can be formed with 0,1,2,3,4,5 and also divisible by 5 with distinct digit

Example for Comparison Test for Improper Integrals Example:  Find out if the following integral is convergent or divergent. ∫ ∞ 2 (cos 2 x) / x 2 (dx) Solution

how many pendulum swings will it take to walk across the classroom

What is Monomials and Polynomials in maths? An expression like 7x is called a monomial. A monomial is an integer, a variable, or a product of integers and variables. Other e

Celine deposited $505 into her savings account. If the interest rate of the account is 5% per year, how much interest will she have made after 4 years? Use the formula F = 9/5

Properties of Dot Product u → • (v → + w → ) = u → • v → + u → • w →          (cv → ) • w → = v → •(cw → ) = c (v → •w → ) v → • w → = w → • v →

1) Find the are length of r(t) = ( 1/2t^2, 1/3t^3, 1/3t^3) where t is between 1 and 3 (greater than or equal less than or equal) 2) Sketch the level curves of f(x,y) = x^2-2y^2