Matsuoka Neural oscillator

Hi all, I am doing a research topic related to robotics. Currently I am developing a C++ code to generate torque output for the legged robot.

Matsuoka Neural Oscillator is designed with multiple mutual inhibiting/exciting neurons to generate outputs with fixed frequency/phase. In addition, they are constructed in first order differential equations. I think by using Euler's method to solve the equations would be one of the straightforward method.

It is a network connection with 2 mutually inhibiting neuron. Please refer to the following link for more info.
http://www.cs.cmu.edu/~hgeyer/Teaching/R16-899B/Assignments/Matsuoka87BiolCybern.pdf (at page 3 for the desired outputs)

Without further ado, let me show you the code that I am working on

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
#include <fstream>
#include <conio.h>

using namespace std;
double dUe1[500], dUf1[500], dVe1[500],dVf1[500];
double dUe2[500], dUf2[500], dVe2[500],dVf2[500];
double Ue1[500], Ue2[500];
double Uf1[500], Uf2[500];
double Ve1[500], Ve2[500];
double Vf1[500], Vf2[500];
double Ye1[500], Ye2[500];
double Yf1[500], Yf2[500];
double Y1[500];
double U0, b, step, T, t1, t2;


double Wfe;

int main()
{
ofstream myfile ("output.txt");
int count = 0;
step = 0.2;
Wfe = 1.5; //lexor&Extensor weight connection
t1 = 1;
t2 = 15;
U0 = 2;
b = 3;

while (count < 500)
{

/*Extensor neuron 1*/

dUe1[count] = (-Ue1[count] - (Wfe * Yf1[count]) - (b * Ve1[count]) + U0) / t1;
Ue1[count + 1] = Ue1[count] + (step * dUe1[count]);
Ye1[count + 1] = max(0.00, Ue1[count + 1]);

dVe1[count] = (-Ve1[count] + Ye1[count + 1]) / t2;
Ve1[count + 1] = Ve1[count] + (step * dVe1[count]);

/*Flexor neuron 1*/

dUf1[count] = (-Uf1[count] - (Wfe * Ye1[count]) - (b * Vf1[count]) + U0) / t1;
Uf1[count + 1] = Uf1[count] + (step * dUf1[count]);
Yf1[count + 1] = max(0.00, Uf1[count + 1]);

dVf1[count] = (-Vf1[count] + Yf1[count + 1]) / t2;
Vf1[count + 1] = Vf1[count] + (step * dVf1[count]);

count++;
}

myfile << "Ye1 output: **************************" << endl;
for (int i=0; i<count; i++)
{
myfile << Ye1[i] << endl;
}

myfile << endl << endl;

myfile << "Yf1 output: **************************" << endl;
for (int j=0; j<count; j++)
{
myfile << Yf1[j] << endl;
}



}


Please let me know whether the code is fundamentally flawed in Euler's method in C++ or problem occurs in somewhere else. Thank you!
Nevermind, I got it solved!

One of the essential part of the Euler's method is to define the initial value of the output in order to extrapolate the following step outputs.

By inserting the initial parameters values, everything will be solved perfectly!
"Ue1[0] = 0;
Ve1[0] = 0;

Uf1[0] = 1;
Vf1[0] = 1;"

Thank you and hope it helps for the others too!
Topic archived. No new replies allowed.