[sdiy] Logistic Equation chaos engine?
s.thomas
s.thomas at qmul.ac.uk
Fri Jul 4 21:30:17 CEST 2003
Hi ..still on the topic of Lorenz attarctors and chaos..it might be fun to see if one could design an anlogue circuit that solves the so called' logistic equation'
(for those who like maths see http://mathworld.wolfram.com/LogisticEquation.html for a nice review and pretty pictures) . The solutions to this equation (or at least the recurrence relation thats based on this equation) can approach chaos ..and show period doubling and bifurcation etc. I would guess it must be possible to solve simple recurrence relations using analogue computer type circuits?
cheers
steve thomas
----- Original Message -----
From: Jaroslaw Ziembicki
To: SDIY
Sent: Friday, July 04, 2003 11:07 AM
Subject: [sdiy] Digital simulation of the Lorenz attractor
Hi,
I wrote a C program that simulates the Lorenz attractor
and plots the results. The graphic mode should be set.
Here is the basic subroutine. Maybe somebody will find
it useful.
Regards
Jarek
void Lorenz(void)
{
/* simulation variables/parameters: */
float x = 0.1;
float y = 0.0;
float z = 0.0;
float s = 10.00;
float r = 28.00;
float b = 2.67;
float dt = 100E-6;
/* graphics' variables/parameters: */
float xxscale = 0.02*(float)(getmaxx()+1); /* for plot scaling */
float yyscale = 0.01*(float)(getmaxy()+1); /* for plot scaling */
WORD xx0 = (getmaxx()+1)/2; /* plot center x */
WORD yy0 = (getmaxy()+1)/2; /* plot center y */
WORD color = 15;
/* border, x and y axes: */
setcolor(DARKGRAY);
rectangle(0,0,getmaxx(),getmaxy());
line(0,yy0,getmaxx(),yy0); line(xx0,0,xx0,getmaxx());
/* loop: */
while ( kbhit() ) getch();
do
{
float dx,dy,dz;
WORD xx,yy;
/* put a pixel: */
xx = xx0+(int)(xxscale*x); yy = yy0-(int)(yyscale*z);
putpixel(xx,yy,color);
/* new x,y,z values: */
dx = dt * (s*(y-x));
dy = dt * (r*x - y - x*z);
dz = dt * (x*y - b*z);
x += dx; y += dy; z += dz;
/* next color: */
color++; if ( color > 15 ) color = 0;
}
while ( !kbhit() );
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://synth-diy.org/pipermail/synth-diy/attachments/20030704/5bbe41e5/attachment.htm>
More information about the Synth-diy
mailing list