I have a system of coupled ODEs that I want to solve. The functions are A(x), B(x), C(x). It is a boundary values problem. I am using Matlab bvp4c.

So far I am not satisfied with my solutions. For the boundaries that are of interest for me, the solver fail (Matlab return "a singular Jacobian encountered"). For some other boundaries, the result depend of the initial guess. So I think that my system is ill defined. I am thinking of adding one constraint but I don't find how to implement it

How to enforce $\int_{a}^{b}d x(A(x)+B(x)+C(x))=N$ ?


1 Answer 1


You could augment your system of ODEs to include one more equation. If you let

\begin{align} I(x) = \int_{a}^{x}(A(s) + B(s) + C(s))\,\mathrm{d}s, \end{align}

then $I(a) = 0$, $I(b) = N$, $\dot{I}(x) = A(x) + B(x) + C(x)$, and you have another boundary value problem that you can solve in MATLAB using bvp4c.

  • 1
    $\begingroup$ Is the condition $I(a)=0$ necessary? Since $I(x)=\int_{a}^{x} (A(s)+B(s)+C(s)) ds$, then $I(a)=0$ comes by definition so it should not be required. I am asking this because I have now a system with too many boundary conditions since I added only one equation of first order but with two additional constraints ($I(a)$ and $I(b)$) $\endgroup$
    – David
    Commented Dec 23, 2014 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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