Strizhak-Kawczynski model - chemical chaotic system

Dependencies:   mbed

Committer:
JLS
Date:
Tue Mar 15 22:14:06 2011 +0000
Revision:
0:4427cf13018e

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JLS 0:4427cf13018e 1 #include "TFT_4DGL.h"
JLS 0:4427cf13018e 2
JLS 0:4427cf13018e 3 TFT_4DGL lcd(p9,p10,p11);
JLS 0:4427cf13018e 4
JLS 0:4427cf13018e 5 int main() {
JLS 0:4427cf13018e 6
JLS 0:4427cf13018e 7 int xp,yp;
JLS 0:4427cf13018e 8
JLS 0:4427cf13018e 9 int n = WHITE;
JLS 0:4427cf13018e 10
JLS 0:4427cf13018e 11 float x,y,z;
JLS 0:4427cf13018e 12
JLS 0:4427cf13018e 13 float a = 150;
JLS 0:4427cf13018e 14 float b = 436.6;
JLS 0:4427cf13018e 15 float b1 = 3.714;
JLS 0:4427cf13018e 16 float b2 = 21.7;
JLS 0:4427cf13018e 17 float q = 0.07;
JLS 0:4427cf13018e 18 float r = 0.101115;
JLS 0:4427cf13018e 19 float ax1 = 10;
JLS 0:4427cf13018e 20 float ax2 = 11;
JLS 0:4427cf13018e 21 float ax3 = 20;
JLS 0:4427cf13018e 22
JLS 0:4427cf13018e 23 float dt = 0.1;
JLS 0:4427cf13018e 24
JLS 0:4427cf13018e 25 float x1 = 0;
JLS 0:4427cf13018e 26 float y1 = 0;
JLS 0:4427cf13018e 27 float z1 = 0;
JLS 0:4427cf13018e 28
JLS 0:4427cf13018e 29
JLS 0:4427cf13018e 30 x = x1;
JLS 0:4427cf13018e 31 y = y1;
JLS 0:4427cf13018e 32 z = z1;
JLS 0:4427cf13018e 33
JLS 0:4427cf13018e 34 while(1)
JLS 0:4427cf13018e 35
JLS 0:4427cf13018e 36 {
JLS 0:4427cf13018e 37
JLS 0:4427cf13018e 38 x = x1+(r*(y1-(x1-ax1)*(x1-ax2)*(x1-ax3)-a))*dt;
JLS 0:4427cf13018e 39 y = y1+(b-b1*z1-b2*x1-y1)*dt;
JLS 0:4427cf13018e 40 z = z1+(q*(x1-z1))*dt;
JLS 0:4427cf13018e 41
JLS 0:4427cf13018e 42 xp = (int)floor(x*20);
JLS 0:4427cf13018e 43 yp = (int)floor(y*2);
JLS 0:4427cf13018e 44
JLS 0:4427cf13018e 45 lcd.pixel(-150+xp,-20+yp,n);
JLS 0:4427cf13018e 46
JLS 0:4427cf13018e 47 x1 = x;
JLS 0:4427cf13018e 48 y1 = y;
JLS 0:4427cf13018e 49 z1 = z;
JLS 0:4427cf13018e 50
JLS 0:4427cf13018e 51 }
JLS 0:4427cf13018e 52
JLS 0:4427cf13018e 53 }