Lorenz limit cycle - 2D nonlinear attractor

Dependencies:   mbed

Revision:
0:337717573fe7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Feb 08 21:43:36 2011 +0000
@@ -0,0 +1,41 @@
+#include "TFT_4DGL.h"
+
+TFT_4DGL lcd(p9,p10,p11);
+
+int main() {
+
+     int   xp,yp;
+     
+     int n = WHITE;
+   
+     float x,y,xn,yn;
+
+     float dt = 0.55;
+  
+     float x1 = 0.1;
+     float y1 = 0;
+     
+     x = x1;
+     y = y1;
+
+    while(1)
+    
+    {
+    
+        xn = x1-y1-pow(x1,3);
+        yn = x1-(x1*x1)*y1;
+        
+        x = x+xn*dt;
+        y = y+yn*dt;
+
+        xp = (int)floor(x*65);
+        yp = (int)floor(y*110);
+
+        lcd.pixel(120+xp,160+yp,n);
+     
+        x1 = x;
+        y1 = y;
+        
+    }
+ 
+}
\ No newline at end of file