Kamil Ondrousek / Mbed 2 deprecated Lorenz-Mod1

Dependencies:   mbed

Committer:
JLS
Date:
Tue Jan 04 20:40:50 2011 +0000
Revision:
0:17a1e0dcb266

        

Who changed what in which revision?

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