lorenz_gate

Lorenz chaotic attractor - gate https://en.wikipedia.org/wiki/Lorenz_system
Author: JLS
License: BSD
Github: jls/logic/lorenz_gate.axo

Inlets

bool32.rising trigger

bool32.rising reset

Outlets

bool32 positive value gate

bool32 negative value gate

frac32.bipolar output

Declaration
float x;
float tx;
float y;
float ty;
float z;
float tz;
float s;
float r;
float b;
float dt;
int res;
int ntrig;
Init
x = 0.1;
y = 0.1;
z = 0.1;
s = 10.0;
r = 28.0;
b = 2.66;
dt = 0.005;
res = 0;
ntrig = 0;
Control Rate
if ((inlet_trig > 0) && !ntrig) {

  ntrig = 1;

  tx = s * (y - x);
  ty = (r * x) - y - (x * z);
  tz = (x * y) - (b * z);

  x = x + tx * dt;
  y = y + ty * dt;
  z = z + tz * dt;

} else if (!(inlet_trig > 0))
  ntrig = 0;

outlet_out = (0.7 * x * (1 << 23));

if (x > 0)
  outlet_pos = 1;
else
  outlet_pos = 0;
if (x < 0)
  outlet_neg = 1;
else
  outlet_neg = 0;

if ((inlet_reset > 0) && !res) {

  res = 1;
  x = 0.1;
  y = 0.1;
  z = 0.1;
  outlet_pos = 0;
  outlet_neg = 0;
  outlet_out = 0;

} else if (!(inlet_reset > 0))
  res = 0;

Privacy

© 2024 Zrna Research