• Remix
  • Share
  • New Entry

  • JKMSMKJ

  • /
  • A Stellar Collision on the Galactic Stage

on 3 Nov 2024
  • 21
  • 158
  • 0
  • 1
  • 786
Cite your audio source here (if applicable):
%Courtesy WolframTones: https://tones.wolfram.com/generate/GwCf7PsvWUmYnTfiNskIQi5r2q05SEbVhzvNaHpykQLk
drawframe(1);
Write your drawframe function below
function drawframe(f)
%A particular application of Hiroza equation.
%For more info: https://1drv.ms/b/s!AhGovQArU6bHgtpGy-KSv9nWQKWY-g
persistent ax k N S T im
if f==1
%Initialize stuff
ax=axes;
k=0;
N=1283;
S=13.5;
T=ones(102)*(0.0000095*1i);
T(6:97,6:97)=0;
%Set up Galactic Background: Adapted from Adam Danz's "Texture from Noise" tutorial.
rng(0,'twister') %Parameter 1. random number generator seed
mf=fftshift(fft2(randn(102))); %Parameter 2. k-by-k matrix
d=((1:102)-(102/2)-1).^2;
filt=sqrt(d(:)+d(:)').^(-2); %Parameter 3. 1/fᵅ exponent for frequency filter
filt(isinf(filt))=1; %replace +/-inf at DC or zero-frequency component
imagesc(ax,ifft2(ifftshift(mf.*filt)));
ax.Visible="off";
axis(ax,'image');
colormap(ax,"pink");
%Plot |Re(T)| over the BG :)
ax=axes;
im=imagesc(ax,abs(real(T)));
alpha=ones(102);
alpha(im.CData<=mean(im.CData,"all","omitmissing"))=0;
im.AlphaData=alpha;
ax.Visible="off";
axis(ax,'image');
colormap(ax,'jet');
clim(ax,[0 Inf]);
else
Tp=zeros(102); %Some more initializations
alpha=ones(102);
%Iterate...
while k<=N
k=k+1;
%...the Hiroza equation
Tp(2:101,2:101)=sqrt(T(2:101,3:102).*T(2:101,1:100)+T(3:102,2:101).*T(1:100,2:101))-1/4;
T=Tp; %T is to be iterated but Tp is to be plotted below!
% & stop whenever frame "f" is ready
if rem(k,S)==0 || rem(k,S)==0.5
Tp(isinf(Tp) | isnan(Tp))=0; %Blown up values set to 0 for plotting purposes!
im.CData=abs(real(Tp)); %Frame "f" drawn,
alpha(im.CData<=mean(im.CData,"all","omitmissing"))=0;
im.AlphaData=alpha;
break %so get out of here!
end
end
end
end
Movie
Audio
Remix Tree