Chua chaotic oscillator - 640x480 vga
Dependencies: fastlib mbed vga640x480g
main.cpp
00001 #include "mbed.h" 00002 #include "vga640x480g.h" 00003 00004 int main() { 00005 00006 init_vga(); 00007 00008 vga_cls(); 00009 00010 vga_box(0,0,639,479,WHITE); 00011 00012 vga_putstring(10,10,"Chua chaotic oscillator",WHITE); 00013 00014 float x = 0.5; 00015 float y = 0.25; 00016 float z = 0.125; 00017 float oldx = 0; 00018 float oldy = 0; 00019 float oldz = 0; 00020 00021 float dt = 0.005; 00022 00023 float alpha = 15.6; 00024 float beta = 28.58; 00025 float a = -1.14286; 00026 float b = -0.714286; 00027 float h = 0; 00028 00029 int xout = 0; 00030 int yout = 0; 00031 00032 while (1) { 00033 00034 oldx = x; 00035 oldy = y; 00036 oldz = z; 00037 00038 h = (b * x) + (0.5 * (a - b) * (abs(x+1) - abs(x-1))); 00039 00040 x = oldx + dt * (alpha * (oldy - oldx - h)); 00041 y = oldy + dt * (oldx - oldy + oldz); 00042 z = oldz + dt * (-beta * oldy); 00043 00044 xout = 320+(136*x); 00045 yout = 240+(556*y); 00046 00047 vga_plot(xout,yout,WHITE); 00048 00049 } 00050 00051 } 00052
Generated on Tue Jul 12 2022 18:57:22 by 1.7.2