7
$\begingroup$

Specifically, ode15i. I have ode15i solving a system of 5 first order implicit odes in 5 variables with an initial condition (made consistent by decic). It's great for what I need, except I need to add a final condition as well. Is this possible? I think (but am not sure) ode15s works too.

Edit: -

Edit 2: I think I figured it out. I'm going to make dummy variables for all the derivatives, add in a bunch of extra equations, and that should make the equations "explicit" so I can use bvp4c.

$\endgroup$

migrated from math.stackexchange.com Jul 23 '13 at 22:34

This question came from our site for people studying math at any level and professionals in related fields.

  • $\begingroup$ Just to clarify, you have $y(0)$ as the initial condition and you also need that $y(T)$ be the specified value from your application. $\endgroup$ – Daryl Jul 23 '13 at 21:04
  • $\begingroup$ Would you mind providing more details $\endgroup$ – Paul Renton Jul 23 '13 at 21:26
  • $\begingroup$ We are going to need more datails. Unless there are tunable parameters in your equations (or you initial conditions) the equations are over-determined. $\endgroup$ – Godric Seer Jul 23 '13 at 22:52
  • $\begingroup$ What details do you need? The five variables are all functions of t, and I would like to set (only one or two) of them with a boundary condition at a set time t. $\endgroup$ – Samuel Reid Jul 23 '13 at 22:58
  • $\begingroup$ Are you simply asking to stop the solver when/if $y(t)$ reaches a critical value, or are you saying that $y(t)$ must reach that critical value at a set time? The former isn't a boundary condition but rather a special termination condition (that can easily be handled with MATLAB's ODE solvers.) $\endgroup$ – Brian Borchers Jul 23 '13 at 22:59
2
$\begingroup$

The MATLAB routines starting with 'ode', like ode15i, are for solving initial value problems. If you want to solve a boundary value problem, use bvp4c or bvp5c.

$\endgroup$
  • $\begingroup$ The problem is, bvp4c and bvp5c are only for explicit equations. My equations are all very much implicit. $\endgroup$ – Samuel Reid Jul 24 '13 at 16:54
  • 1
    $\begingroup$ In order to make your question useful to others, could you please write down one of your BVPs? This will make it clear what you mean by "implicit". $\endgroup$ – David Ketcheson Jul 24 '13 at 23:15
5
$\begingroup$

I assume that you want to solve $$f(t,y',y)=0 \text{ on } (0,T)$$ with two-point boundary values $$y(0)=\alpha \text{ and } y(T)=\beta.$$

You cannot simply apply ODE solvers to this problen unless you take the heuristic approach of forward-backward iteration (see the list below).

There is no general approach to these boundary value problems. And I don't didn't know of any built-in function in Matlab that solves these boundary value problems even for the case with $y' = \tilde f (t,y)$.

[EDIT: There are matlab functions for solving these semi-explicit two point boundary value problems, see David Ketcheson's answer, that use finite differences and collocation. ]

So, my answer is, there is no answer to your particular question, how to make Matlab's ODE solvers handle your problem.

To solve the problem you have the following options:

  • Finite Differences: Discretize the interval $[0,T]$, if necessary do a collocation, and solve the resulting algebraic system
  • (Multiple) Shooting: parametrize the boundary conditions and solve for the parameters
  • Decoupling: split the variables so that there is one initial value problem, and one terminal value, i.e. backward in time initial value, problem. In the linear case this is commonly referred to as Riccati decoupling
  • Fixed-point Iteration: this is the most heuristic approach. For example, you can try to guess the missing intial values, integrate forward in time, set the part of the terminal value to the given values, integrate backward in time, and so on...

The standard reference for these problems is the book by Ascher, Mattheij, & Russell: Numerical solution of boundary value problems for ordinary differential equations. However, implicit problems are not considered there.

$\endgroup$
  • $\begingroup$ Hello, thank you for the answer! I've actually heard of all of these methods. I know finite differences is horrible for accuracy, and shooting isn't good if the system is unstable (which mine is). It's also a system of five implicit odes, and I'm having a lot of trouble finding resources on this kind of question. Any idea where I could? I'm guessing my question has all the annoying words in it, "multiple equations", "implicit", "boundary conditions" etc. and that's why it's so difficult. $\endgroup$ – Samuel Reid Jul 24 '13 at 16:34
  • 2
    $\begingroup$ @SamuelReid: Perhaps you could state the system of ODEs and boundary conditions you'd like to impose in an edit to the question so that people can be more helpful. $\endgroup$ – Bill Barth Jul 24 '13 at 17:05
  • $\begingroup$ @BillBarth: Sure. $\endgroup$ – Samuel Reid Jul 24 '13 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.