Rucklidge chaotic attractor

Committer:
JLS
Date:
Mon Jan 03 13:57:46 2011 +0000
Revision:
0:73bfbf91b6e5

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JLS 0:73bfbf91b6e5 1 #include "TFT_4DGL.h"
JLS 0:73bfbf91b6e5 2
JLS 0:73bfbf91b6e5 3 TFT_4DGL lcd(p9,p10,p11);
JLS 0:73bfbf91b6e5 4
JLS 0:73bfbf91b6e5 5 int main() {
JLS 0:73bfbf91b6e5 6
JLS 0:73bfbf91b6e5 7 double x1,y1,z1,x,y,z,t,dt;
JLS 0:73bfbf91b6e5 8 int xp,yp;
JLS 0:73bfbf91b6e5 9
JLS 0:73bfbf91b6e5 10 float k = 2;
JLS 0:73bfbf91b6e5 11 float a = 6.7;
JLS 0:73bfbf91b6e5 12
JLS 0:73bfbf91b6e5 13 x1 = 1;
JLS 0:73bfbf91b6e5 14 y1 = 0;
JLS 0:73bfbf91b6e5 15 z1 = 4.5;
JLS 0:73bfbf91b6e5 16
JLS 0:73bfbf91b6e5 17 dt = 0.01;
JLS 0:73bfbf91b6e5 18
JLS 0:73bfbf91b6e5 19 while(1)
JLS 0:73bfbf91b6e5 20
JLS 0:73bfbf91b6e5 21 {
JLS 0:73bfbf91b6e5 22
JLS 0:73bfbf91b6e5 23 x = x1+(-k*x1+a*y1-y1*z1)*dt;
JLS 0:73bfbf91b6e5 24 y = y1+(x1)*dt;
JLS 0:73bfbf91b6e5 25 z = z1+(-z+pow(y1,2))*dt;
JLS 0:73bfbf91b6e5 26 t = t+dt;
JLS 0:73bfbf91b6e5 27
JLS 0:73bfbf91b6e5 28 xp = 160+(int)floor(14*x);
JLS 0:73bfbf91b6e5 29 yp = 120+(int)floor(19*y);
JLS 0:73bfbf91b6e5 30
JLS 0:73bfbf91b6e5 31 lcd.pixel(yp,xp,WHITE);
JLS 0:73bfbf91b6e5 32
JLS 0:73bfbf91b6e5 33 x1 = x;
JLS 0:73bfbf91b6e5 34 y1 = y;
JLS 0:73bfbf91b6e5 35 z1 = z;
JLS 0:73bfbf91b6e5 36
JLS 0:73bfbf91b6e5 37 }
JLS 0:73bfbf91b6e5 38
JLS 0:73bfbf91b6e5 39 }