Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been trying to use the ODE15s built-in function of Matlab to solve the following system of equations:



where $y_1$ and $y_2$ are column vectors of size $(h,1)$, where $h$ is any integer. I tried several things but none worked. I would appreciate any ideas. I am beginning to think that this is impossible because the $y's$ are vectors rather than numbers.


share|cite|improve this question
Did you try to write your equation as $\frac{dy}{dt} = f(y)$ where $y$ is a column vector of size $2h$, with the first $h$ entries being $y_1$ and the last $h$ entries being $y_2$? If yes, why didn't that work? – Jitse Niesen May 28 '12 at 12:36
$f_1$ and $f_2$ are different so I don't think I can assemble them like that. – Hooman May 28 '12 at 14:23
I managed to solve the problem by assembling the vectors and the functions (according to the functions and the problem) and solved the problem. I don't think there is a way to solve this problem without making them all one. – Hooman May 30 '12 at 16:07
Why is this question here, instead of a Matlab forum? – marty cohen Jul 18 '13 at 14:40

Concatenating the vectors $y_1$ and $y_2$ into one longer vector (and doing the same for functions) turns a system into a single equation for vector valued function. (As Jitse Niesen said.) Matlab solvers expect you to do this conversion before invoking them. Related: How to do Runge-Kutta with two coupled differential equations?

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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