- /
 - 
        
orbits
 
        on 7 Oct 2024
        
        
 
    - 11
 - 269
 - 2
 - 1
 - 1213
 
 Cite your audio source here (if applicable): inspired by the work of: https://x.com/S_Conradi
drawframe(1);
 Write your drawframe function below
function drawframe(f)
% Define parameters with time evolution
n_points = 300;   
n_iter = 100;     
a = 5.758 + 0.1 * sin(2 * pi * f / 96);  % Modulate 'a'
b = 5.291 + 0.1 * cos(2 * pi * f / 96);  % Modulate 'b'
% Initialize the histogram grid
n_bins = 600;
x_edges = linspace(-1, 1, n_bins + 1);
y_edges = linspace(-1, 1, n_bins + 1);
counts = zeros(n_bins, n_bins);
% Initial grid of points
x = linspace(-1, 1, n_points);
y = linspace(-1, 1, n_points);
[xx, yy] = meshgrid(x, y);
% Orbit calculations with histogram update
for iter = 1:n_iter
    xx_new = sin(xx.^2 - yy.^2 + a);
    yy_new = cos(2 .* xx .* yy + b);
    xx = xx_new;
    yy = yy_new;
    % Map points to histogram bins
    x_idx = discretize(xx(:), x_edges);
    y_idx = discretize(yy(:), y_edges);
    valid = ~isnan(x_idx) & ~isnan(y_idx);
    x_idx = x_idx(valid);
    y_idx = y_idx(valid);
    % Increment histogram counts
    idx = sub2ind([n_bins, n_bins], y_idx, x_idx);
    temp_counts = accumarray(idx, 1, [n_bins * n_bins, 1]);
    counts = counts + reshape(temp_counts, n_bins, n_bins);
end
% Apply log scaling
I = log(counts + 1);
% Define the colormap
myColorMap = createColormap('#000000', '#FAF6ED', true);
colormap(myColorMap);
% Display the image
imagesc(I, [0 0.9 * max(I(:))]);
axis image;
axis off;
end
% function to create the colormap
function cmap = createColormap(hexColor1, hexColor2, reverse)
color1 = hex2rgb(hexColor1);
color2 = hex2rgb(hexColor2);
if reverse
    colors = [color2; color1];
else
    colors = [color1; color2];
end
x = linspace(0, 1, size(colors, 1));
cmap = interp1(x, colors, linspace(0, 1, 256));
end
%  function to convert hex to RGB
function rgb = hex2rgb(hex)
hex = strrep(hex, '#', '');
rgb = sscanf(hex, '%2x%2x%2x', [1 3]) / 255;
end
Movie
Audio
This submission does not have audio.


