

I'm trying to plot and animate some Clifford attractors and I'm having problems with the syntax / equation. The image that is produce looks nothing like the website images and idea how I can adjust the code? What they look like along with the equation variables http://paulbourke.net/fractals/clifford/Code: I'm using: x=1; y=1; t= linspace (0,1000); a = 1.24458; b = 1.25191; c = 1.815908; d = 1.90866; x=sin(a*y.*t)+c*cos(x.*t); y=sin(b*x.*t)+d*cos(y.*t); plot(x,y) 


I'm trying to plot and animate some Clifford attractors and I'm having problems with the syntax / equation. The image that is produce looks nothing like the website images and idea how I can adjust the code? What they look like along with the equation variables http://paulbourke.net/fractals/clifford/Code: I'm using: x=1; y=1; t= linspace (0,1000); a = 1.24458; b = 1.25191; c = 1.815908; d = 1.90866; x=sin(a*y.*t)+c*cos(x.*t); y=sin(b*x.*t)+d*cos(y.*t); plot(x,y)
What you have programmed is not even close to:
x_{n+1} = sin(a y_{n}) + c cos(a x_{n}) y_{n+1} = sin(b x_{n}) + d cos(b y_{n})
You must do a loop because the second value in x or y is calculated during the first time through the loop.
 DAS


From the site you linked: Definition
x _{n+1} = sin(a y _{n}) + c cos(a x _{n})
y _{n+1} = sin(b x _{n}) + d cos(b y _{n})
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:
x(1)=1; y(1)=1; a = 1.24458; b = 1.25191; c = 1.815908; d = 1.90866;
maxiter = 1000; z = linspace(1,maxiter+1,maxiter+1); for k=1:maxiter x(k+1) = sin(a*y(k)) + c*cos(a*x(k)); y(k+1) = sin(b*x(k)) + d*cos(b*y(k)); end
plot3(x,y,z)
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?
Answer:
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.
I'm trying to plot and animate some Clifford attractors and I'm having problems with the syntax / equation. The image that is produce looks nothing like the website images and idea how I can adjust the code? What they look like along with the equation variables http://paulbourke.net/fractals/clifford/Code: I'm using: x=1; y=1; t= linspace (0,1000); a = 1.24458; b = 1.25191; c = 1.815908; d = 1.90866; x=sin(a*y.*t)+c*cos(x.*t); y=sin(b*x.*t)+d*cos(y.*t); plot(x,y) 


From the site you linked: Definition
x _{n+1} = sin(a y _{n}) + c cos(a x _{n})
y _{n+1} = sin(b x _{n}) + d cos(b y _{n})
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:
x(1)=1; y(1)=1; a = 1.24458; b = 1.25191; c = 1.815908; d = 1.90866;
maxiter = 1000; z = linspace(1,maxiter+1,maxiter+1); for k=1:maxiter x(k+1) = sin(a*y(k)) + c*cos(a*x(k)); y(k+1) = sin(b*x(k)) + d*cos(b*y(k)); end
plot3(x,y,z)
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?
Answer:
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.
I'm trying to plot and animate some Clifford attractors and I'm having problems with the syntax / equation. The image that is produce looks nothing like the website images and idea how I can adjust the code? What they look like along with the equation variables http://paulbourke.net/fractals/clifford/Code: I'm using: x=1; y=1; t= linspace (0,1000); a = 1.24458; b = 1.25191; c = 1.815908; d = 1.90866; x=sin(a*y.*t)+c*cos(x.*t); y=sin(b*x.*t)+d*cos(y.*t); plot(x,y) 



From the site you linked: Definition
x _{n+1} = sin(a y _{n}) + c cos(a x _{n})
y _{n+1} = sin(b x _{n}) + d cos(b y _{n})
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:
x(1)=1; y(1)=1; a = 1.24458; b = 1.25191; c = 1.815908; d = 1.90866;
maxiter = 1000; z = linspace(1,maxiter+1,maxiter+1); for k=1:maxiter x(k+1) = sin(a*y(k)) + c*cos(a*x(k)); y(k+1) = sin(b*x(k)) + d*cos(b*y(k)); end
plot3(x,y,z)
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?
Answer:
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.
I'm trying to plot and animate some Clifford attractors and I'm having problems with the syntax / equation. The image that is produce looks nothing like the website images and idea how I can adjust the code? What they look like along with the equation variables http://paulbourke.net/fractals/clifford/Code: I'm using: x=1; y=1; t= linspace (0,1000); a = 1.24458; b = 1.25191; c = 1.815908; d = 1.90866; x=sin(a*y.*t)+c*cos(x.*t); y=sin(b*x.*t)+d*cos(y.*t); plot(x,y) 



RT wrote
> I'm trying to plot and animate some Clifford attractors and I'm having
> problems with the syntax / equation. The image that is produce looks
> nothing like the website images and idea how I can adjust the code?
>
> What they look like along with the equation variables
> http://paulbourke.net/fractals/clifford/>
> Code: I'm using:
> x=1;
> y=1;
> t= linspace (0,1000);
> a = 1.24458; b = 1.25191; c = 1.815908; d = 1.90866;
>
> x=sin(a*y.*t)+c*cos(x.*t);
> y=sin(b*x.*t)+d*cos(y.*t);
> plot(x,y)
At the bottom of that page is a description of how the plots were made, did
you read that?
Looks quite a bit more involved than a plain "plot (x, y)".
Philip

Sent from: https://octave.1599824.n4.nabble.com/OctaveGeneralf1599825.html


El dissabte, 7 de setembre de 2019, a les 20:38:53 EDT, RT va escriure:
I'm trying to plot and animate some Clifford attractors and I'm having
problems with the syntax / equation. The image that is produce looks
nothing like the website images and idea how I can adjust the code?
What they look like along with the equation variables
http://paulbourke.net/fractals/clifford/
Code: I'm using:
x=1;
y=1;
t= linspace (0,1000);
a = 1.24458; b = 1.25191; c = 1.815908; d = 1.90866;
x=sin(a*y.*t)+c*cos(x.*t);
y=sin(b*x.*t)+d*cos(y.*t);
plot(x,y)
Did you see the link to the source code in C by Paul Richards? http://paulbourke.net/fractals/clifford/paul_richards/main.cpp

