Initial value problems, math, Mathematics

Assignment Help:
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.
Outputs
• xend: result of integration at t =tspan(2).
• t: vector of times at which intermediate values have been computed (this should have N + 1
entries).
• 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.

Related Discussions:- Initial value problems, math

Minimizes the sum of the two distance, The value of y that minimizes the su...

The value of y that minimizes the sum of the two distances from (3,5) to (1,y) and from (1,y) to (4,9) can be written as a/b where a and b are coprime positive integers. Find a+b.

Three set problems, In a class,there are 174 students in form three,86 stud...

In a class,there are 174 students in form three,86 students play table tennis,84 play football and 94 play volleyball,30 play table tennis and volleyball,34 play volleyball and foo

Measurement story problem, Seth has a pet goldfish. When he got his goldfis...

Seth has a pet goldfish. When he got his goldfish , it was only 5 centimeters long . Now it has grown to be 92 millimeters long. How many millimeters has the goldfish grown since

Integration, integral 0 to 4 integral 0 to y root of 9+ysquredxdy

integral 0 to 4 integral 0 to y root of 9+ysquredxdy

#t, show that a*0=a

show that a*0=a

Find out that sets of functions are linearly dependent, Find out if the fol...

Find out if the following sets of functions are linearly dependent or independent.  (a) f (  x ) = 9 cos ( 2 x )    g (  x ) = 2 cos2 (  x ) -  2 sin 2 (  x ) (b) f

Explain why f must be a di?erentiable function, Let f : R 3 → R be de?ned ...

Let f : R 3 → R be de?ned by:                                        f(x, y, z) = xy 2 + x 3 z 4 + y 5 z 6 a) Compute ~ ∇f(x, y, z) , and evaluate ~ ∇f(2, 1, 1) . b) Brie?y

Determine the order of the local truncation error, The backwards Euler diff...

The backwards Euler difference operator is given by for differential equation y′ = f(t, y). Determine the order of the local truncation error. Explain why this difference o

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd