Hi:

Im trying to implement a space-state control on arduino and I'm trying to figure out how to implement the integrator (the same integrator that Matlab has) as per my research the integrator should be like this:

```
double Yn = 0;
double Yn1 = 0;
double Xn = 0;
double Xn1 = 0;
void setup(){
Serial.begin(9600);
}
void loop(){
double Xn = 1000;
Yn=Yn1+0.5*(Xn-Xn1);
Xn1=Xn;
Yn1=Yn;
Serial.println(Xn1);
delay(1);
}
```

where Xn is the independent variable (value). Is there anyone that has implemented such control succesfully?