Circular limit cycle - 2D nonlinear attractor

Dependencies:   mbed

main.cpp

Committer:
JLS
Date:
2011-02-08
Revision:
0:ba94dffa2c21

File content as of revision 0:ba94dffa2c21:

#include "TFT_4DGL.h"

TFT_4DGL lcd(p9,p10,p11);

int main() {

     int   xp,yp;
     
     int n = WHITE;
   
     float x,y,xn,yn;

     float dt = 0.814;
  
     float x1 = 0.1;
     float y1 = 0;
     
     x = x1;
     y = y1;

    while(1)
    
    {
    
        xn = y1;
        yn = (1-(x1*x1)-(y1*y1))*y1-x1;
        
        x = x+xn*dt;
        y = y+yn*dt;

        xp = (int)floor(x*65);
        yp = (int)floor(y*110);

        lcd.pixel(120+xp,160+yp,n);
     
        x1 = x;
        y1 = y;
        
    }
 
}