
Rayleigh–Benard System - chaos in convection
main.cpp@0:a1daec69522c, 2011-02-16 (annotated)
- Committer:
- JLS
- Date:
- Wed Feb 16 22:02:14 2011 +0000
- Revision:
- 0:a1daec69522c
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JLS | 0:a1daec69522c | 1 | #include "TFT_4DGL.h" |
JLS | 0:a1daec69522c | 2 | |
JLS | 0:a1daec69522c | 3 | TFT_4DGL lcd(p9,p10,p11); |
JLS | 0:a1daec69522c | 4 | |
JLS | 0:a1daec69522c | 5 | int main() { |
JLS | 0:a1daec69522c | 6 | |
JLS | 0:a1daec69522c | 7 | float x,y,z; |
JLS | 0:a1daec69522c | 8 | int xp,yp; |
JLS | 0:a1daec69522c | 9 | |
JLS | 0:a1daec69522c | 10 | float a = 9; |
JLS | 0:a1daec69522c | 11 | float r = 12; |
JLS | 0:a1daec69522c | 12 | float b = 5; |
JLS | 0:a1daec69522c | 13 | |
JLS | 0:a1daec69522c | 14 | float dt = 0.05; |
JLS | 0:a1daec69522c | 15 | |
JLS | 0:a1daec69522c | 16 | float x1 = 0.1; |
JLS | 0:a1daec69522c | 17 | float y1 = 0; |
JLS | 0:a1daec69522c | 18 | float z1 = 0; |
JLS | 0:a1daec69522c | 19 | |
JLS | 0:a1daec69522c | 20 | while(1) |
JLS | 0:a1daec69522c | 21 | |
JLS | 0:a1daec69522c | 22 | { |
JLS | 0:a1daec69522c | 23 | |
JLS | 0:a1daec69522c | 24 | x = x1+(-a*x1+a*y1)*dt; |
JLS | 0:a1daec69522c | 25 | y = y1+(r*x1-y1-x1*z1)*dt; |
JLS | 0:a1daec69522c | 26 | z = z1+(x1*y1-b*z1)*dt; |
JLS | 0:a1daec69522c | 27 | |
JLS | 0:a1daec69522c | 28 | xp = (int)floor(z*9); |
JLS | 0:a1daec69522c | 29 | yp = (int)floor(y*10); |
JLS | 0:a1daec69522c | 30 | |
JLS | 0:a1daec69522c | 31 | lcd.pixel(20+xp,160+yp,WHITE); |
JLS | 0:a1daec69522c | 32 | |
JLS | 0:a1daec69522c | 33 | x1 = x; |
JLS | 0:a1daec69522c | 34 | y1 = y; |
JLS | 0:a1daec69522c | 35 | z1 = z; |
JLS | 0:a1daec69522c | 36 | |
JLS | 0:a1daec69522c | 37 | } |
JLS | 0:a1daec69522c | 38 | |
JLS | 0:a1daec69522c | 39 | } |