Lorenz limit cycle - 2D nonlinear attractor

Dependencies:   mbed

Committer:
JLS
Date:
Tue Feb 08 21:43:36 2011 +0000
Revision:
0:337717573fe7

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JLS 0:337717573fe7 1 #include "TFT_4DGL.h"
JLS 0:337717573fe7 2
JLS 0:337717573fe7 3 TFT_4DGL lcd(p9,p10,p11);
JLS 0:337717573fe7 4
JLS 0:337717573fe7 5 int main() {
JLS 0:337717573fe7 6
JLS 0:337717573fe7 7 int xp,yp;
JLS 0:337717573fe7 8
JLS 0:337717573fe7 9 int n = WHITE;
JLS 0:337717573fe7 10
JLS 0:337717573fe7 11 float x,y,xn,yn;
JLS 0:337717573fe7 12
JLS 0:337717573fe7 13 float dt = 0.55;
JLS 0:337717573fe7 14
JLS 0:337717573fe7 15 float x1 = 0.1;
JLS 0:337717573fe7 16 float y1 = 0;
JLS 0:337717573fe7 17
JLS 0:337717573fe7 18 x = x1;
JLS 0:337717573fe7 19 y = y1;
JLS 0:337717573fe7 20
JLS 0:337717573fe7 21 while(1)
JLS 0:337717573fe7 22
JLS 0:337717573fe7 23 {
JLS 0:337717573fe7 24
JLS 0:337717573fe7 25 xn = x1-y1-pow(x1,3);
JLS 0:337717573fe7 26 yn = x1-(x1*x1)*y1;
JLS 0:337717573fe7 27
JLS 0:337717573fe7 28 x = x+xn*dt;
JLS 0:337717573fe7 29 y = y+yn*dt;
JLS 0:337717573fe7 30
JLS 0:337717573fe7 31 xp = (int)floor(x*65);
JLS 0:337717573fe7 32 yp = (int)floor(y*110);
JLS 0:337717573fe7 33
JLS 0:337717573fe7 34 lcd.pixel(120+xp,160+yp,n);
JLS 0:337717573fe7 35
JLS 0:337717573fe7 36 x1 = x;
JLS 0:337717573fe7 37 y1 = y;
JLS 0:337717573fe7 38
JLS 0:337717573fe7 39 }
JLS 0:337717573fe7 40
JLS 0:337717573fe7 41 }