• Remix
  • Share
  • New Entry

  • VMM

  • /
  • matrix laboratory reaction

on 1 Dec 2023
  • 12
  • 48
  • 1
  • 0
  • 937
function drawframe(nn)
function img = makeCircle(img, center, radius, value)
[x, y] = meshgrid(1:size(img,1), 1:size(img,2));
img((x - center(1)).^2 + (y - center(2)).^2 <= radius.^2) = value;
end
function lap = lapl(x,dist)
lap = (circshift(x,1,1)+circshift(x,-1,1)+circshift(x,1,2)+circshift(x,-1,2)-4*x)/dist^2;
end
range = [1:24 24:-1:1];
persistent caps;
if(isempty(caps))
caps = {};
imgsz=512;
textImage = zeros(imgsz);
textImage = insertText(textImage, [80 130], ['MATLAB' newline '40 years'], 'FontSize', 72, 'BoxOpacity',0, 'FontColor','white');
textImage=rgb2gray(textImage);
se = strel('disk', 4);
textImage = imdilate(textImage, se);
u = 1-textImage;
v = textImage;
ru = 0.23;
rv = 0.1;
f = 0.0990;
k = 0.0565;
Ts = 0.9078947368;
steps = 86000;
capsstep = floor(steps/24);
for i=1:steps
if(mod(i-1,capsstep)==0)
caps{end+1} = u;
end
nu = ru*lapl(u,1)-u.*(v.^2)+f*(1-u);
nv = rv*lapl(v,1)+u.*(v.^2)-v*(f+k);
u = u+Ts*nu;
v = v+Ts*nv;
end
end
im = caps{range(nn)};
im = imbinarize(im,0.5);
imshow(im, [])
colormap hot
end
Animation
Remix Tree