• New Entry

sparkler

siranjeevi gurumani on 29 Oct 2022
  • 1
  • 13
  • 0
  • 0
  • 279
figure(Color='k')
hold;
Current plot held
% function shortcuts
m=@(a,c)max(min(a,c),-c);
s=@vecnorm;
n=@(p)p./s(p);
% random uniformly distributed values on the unit sphere
P=randn(9,2e2);
% iterate gravitational force exchange
A=hot(999);
for k=1:900
Q=P;
% distance of all points to each other
D=reshape(P,9,1,[])-P;
% calculate gravitational exchange force
U=sum(m(D./s(D).^2,10),3)/1e4-1e-3;
% add bounded, cumulative displacement and project result to unit sphere
P=n(P+n(U).*m(s(U),.01));
% plot imitating more points than actually calculated
h=scatter(P(1,:),P(2,:),m(s(P-Q).^-2/2e4,2e5/(2+k)),A(40+k,:),'f'); %
alpha(h,.1)
end
axis off equal
Remix Tree