Solve multiple equal ODE systems that influence each other

182 Views Asked by At

I'm using MATLABs ODE suite to solve a system of 13 differential equations that determine the behavior of a neuron. Now I'd like to add a second neuron, that is operated by the same set of differential equations, but is influenced by the first neuron. More importantly, this second neuron will also influence the first neuron. (Feedforward and feedback between these two cells.)

Is there a convenient way to do this? Can I distribute the differential equations over two function files or do I have to copy them below the original ones, such that there is a longer list of equations in the same file? I'd like to be able to have one file per cell and to somehow keep this organized. (Also in case I might want to expand it again to three or four neurons.)

If my question is in any way unclear or not specific enough, please indicate. I'll try and explain what I'm doing/trying better.

2

There are 2 best solutions below

0
On

You have to split the big vector of all variables into the sub-arrays of the variables of each neuron, call each file with its variables and then concatenate the resulting direction vectors.

If the neurons behave similarly, you should think about having one method (file) with a loop inside for the neuron function-internal part of the direction and after that probably a double loop for the interaction terms. Put the connectivity information into a data structure to be flexible in changing it.

0
On

I have little experience with MATLAB, but one way that I've seen this done in MATLAB is by creating a list (1D matrix?) for each state variable that requires storage. For example, implementing the Hodgkin-Huxley neuron would require a matrix each for gating variables 'm', 'h', and 'n', as well as one for 'V'. Each list is as long as the number of neurons in the simulations. Then make the ith position in the list corresponds to the ith neuron.

The flow of the simulation would look like the following (let N be the number of neurons):

For each time step in the simulation,

1) let 'index = 1'

2) call the system of ODEs in your file using, as arguments, the 1st element from each list/matrix of state variables.

3) add one to the index. If the index is now greater than N, then move the timestep forward by one and start over at (1).

It sounds like you'll also need matrices to store information about the influence of one another. While I know a lot of people do it this way, it seems cumbersome on a larger scale (especially if you ever incorporate neurons with different sets of ODE's). In the long run, I highly recommend migrating to a more object-oriented approach. They should provide a way easier method to 'bind' each instance of a neuron with its variables and equations, and creating any number of neurons will require no additional code.

http://www.mathworks.com/discovery/object-oriented-programming.html