Lorenz attractor

Dependencies:   mbed

Committer:
JLS
Date:
Sun Dec 26 19:29:27 2010 +0000
Revision:
1:0cd968490083
Parent:
0:c284656a6e33
update

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JLS 0:c284656a6e33 1 #include "TFT_4DGL.h"
JLS 0:c284656a6e33 2
JLS 0:c284656a6e33 3 TFT_4DGL lcd(p9,p10,p11);
JLS 0:c284656a6e33 4
JLS 0:c284656a6e33 5 int main() {
JLS 0:c284656a6e33 6
JLS 0:c284656a6e33 7 double x1,y1,z1,x,y,z,t,dt;
JLS 0:c284656a6e33 8 int xp,yp;
JLS 0:c284656a6e33 9
JLS 0:c284656a6e33 10 x1=(y1=(z1=(t=0.0001)));
JLS 0:c284656a6e33 11
JLS 0:c284656a6e33 12 dt=0.01;
JLS 0:c284656a6e33 13
JLS 0:c284656a6e33 14 while(1)
JLS 0:c284656a6e33 15
JLS 0:c284656a6e33 16 {
JLS 0:c284656a6e33 17
JLS 0:c284656a6e33 18 x = x1+(-10.0*x1+10.0*y1)*dt;
JLS 0:c284656a6e33 19 y = y1+(28.0*x1-y1-x1*z1)*dt;
JLS 0:c284656a6e33 20 z = z1+(-(8/3)*z1+x1*y1)*dt;
JLS 0:c284656a6e33 21 t = t+dt;
JLS 0:c284656a6e33 22
JLS 0:c284656a6e33 23 xp = 150+(int)floor(7*x);
JLS 0:c284656a6e33 24 yp = 10+(int)floor(4*z);
JLS 0:c284656a6e33 25
JLS 0:c284656a6e33 26 lcd.pixel(yp,xp,WHITE);
JLS 0:c284656a6e33 27
JLS 0:c284656a6e33 28 x1 = x;
JLS 0:c284656a6e33 29 y1 = y;
JLS 0:c284656a6e33 30 z1 = z;
JLS 0:c284656a6e33 31
JLS 0:c284656a6e33 32 }
JLS 0:c284656a6e33 33
JLS 0:c284656a6e33 34 }