Van Der Pol oscillator

Dependencies:   mbed

main.cpp

Committer:
JLS
Date:
2010-12-30
Revision:
0:03f336a2328f

File content as of revision 0:03f336a2328f:

#include "TFT_4DGL.h"

TFT_4DGL lcd(p9,p10,p11);

int main() {

    double x1,y1,z1,x,y,z,t,dt;
    int   xp,yp;
   
    float a = 5;
    float b = 3;
    float c = 1.788;

    x1 = -1.9;
    y1 = 0;
    z1 = 0;
    
    dt = 0.005;

    while(1)
    
    {
    
        x = x1+(y1)*dt;
        y = y1+(-x1+b*(1-pow(x1,2))*y1+a*sin(c*z1))*dt;
        z = z1+(c)*dt;
        t = t+dt;

        xp = 160+(int)floor(70*x);
        yp = 120+(int)floor(15*y);

        lcd.pixel(yp,xp,WHITE);
      
        x1 = x;
        y1 = y;
        z1 = z;

    }
 
}