Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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

$\frac{dy_{1}}{dt}=f_{1}\left(y_{1},y_{2}\right)$

$\frac{dy_{2}}{dt}=f_{2}\left(y_{1},y_{2}\right)$

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.

Thanks!

share|improve this question
2  
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
add comment

1 Answer

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|improve this answer
add comment

Your Answer

 
discard

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.