From the site you linked:
= sin(a yn
) + c cos(a xn
= sin(b xn
) + d cos(b yn
where a, b, c, d are variables that define each attractor.
In your code, t is a linearly spaced array, and so is x. That's not what you want - you want a recurrence relation. Also, you want a 3D plot if you wish to produce images like those. Here is an example:
a = -1.24458;
b = -1.25191;
c = -1.815908;
d = -1.90866;
maxiter = 1000;
z = linspace(1,maxiter+1,maxiter+1);
x(k+1) = sin(a*y(k)) + c*cos(a*x(k));
y(k+1) = sin(b*x(k)) + d*cos(b*y(k));
However, this won't produce plots like the one on that page either. At the end of the page is the note,
Question: How are the colour effects here achieved?
The main thing happening here is that I don't draw the attractor to the final image.
Rather I create a large grid of 32 bit (int or float) and instead of drawing into
that in colour I evaluate points on the attractor and just increment each cell of
the grid if the attractor passes through it. So it's essentially a 2D histogram for
occupancy. One wants to evaluate the attractor much more/longer than normal in order
to create a reasonable dynamic range and ultimately smooth colour gradients. I then
save this 2D grid, the process of applying smooth colour gradients comes as a secondary
process ... better than trying to encode the right colour during the generation
process. One can even just save the grid as a 16 or 32 bit raw, open in PhotoShop and
apply custom gradient maps there.
Of course this is "just" a density mapping of the histogram and doesn't immediately
allow for colouring based upon other attributes of the attractor path, such as curvature.
But such attributes can be encoded into the histogram encoding, for example the amount
added to a cell being a function of curvature.
I would start with getting the data points using a loop like what I gave, and then thinking of a nice way to process it like the note above.