Chen’s chaotic system

Dependencies:   mbed

main.cpp

Committer:
JLS
Date:
2011-03-28
Revision:
0:b2b911754c11

File content as of revision 0:b2b911754c11:

#include "TFT_4DGL.h"

TFT_4DGL lcd(p9,p10,p11);

int main() {

     int   xp,yp;
     
     int n = WHITE;
   
     float x,y,z;
   
     float a = 35;
     float b = 3;
     float c = 28;
     
     float dt = 0.001;
 
     float x1 = 1;
     float y1 = 1;
     float z1 = 1;

     
     x = x1;
     y = y1;
     z = z1;

    while(1)
    
    {
    
        x = x1+(a*(y1-x1))*dt;
        y = y1+((c-a)*x1-(x1*z1)+(c*y1))*dt;
        z = z1+((x1*y1)-(b*z1))*dt;
 
        xp = (int)floor(5*x);
        yp = (int)floor(3*z);

        lcd.pixel(20+yp,150+xp,n);
     
        x1 = x;
        y1 = y;
        z1 = z;

    }
 
}