Lorenz-84 chaotic attractor

Dependencies:   mbed

Committer:
JLS
Date:
Sat Jan 22 18:08:38 2011 +0000
Revision:
0:add923acfc99

        

Who changed what in which revision?

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