Lorenz attractor

Dependencies:   mbed

main.cpp

Committer:
JLS
Date:
2010-12-26
Revision:
1:0cd968490083
Parent:
0:c284656a6e33

File content as of revision 1:0cd968490083:

#include "TFT_4DGL.h"

TFT_4DGL lcd(p9,p10,p11);

int main() {

    double x1,y1,z1,x,y,z,t,dt;
    int   xp,yp;
   
    x1=(y1=(z1=(t=0.0001)));
    
    dt=0.01;

    while(1)
    
    {
    
        x = x1+(-10.0*x1+10.0*y1)*dt;
        y = y1+(28.0*x1-y1-x1*z1)*dt;
        z = z1+(-(8/3)*z1+x1*y1)*dt;
        t = t+dt;

        xp = 150+(int)floor(7*x);
        yp = 10+(int)floor(4*z);

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

    }
 
}