Skip to content

Instantly share code, notes, and snippets.

@danzimmerman
Last active April 1, 2018 15:26
Show Gist options
  • Save danzimmerman/9fbe2d3e618c3236d05f183073abd05f to your computer and use it in GitHub Desktop.
Save danzimmerman/9fbe2d3e618c3236d05f183073abd05f to your computer and use it in GitHub Desktop.
f = [0.85:0.01:1.085]
t = 0:1/50:120-1/50;
sinmat = zeros(length(f),length(t));
[xs ys zs] = sphere(40);
xs = 0.05*xs;
ys = 0.05*ys;
zs = 0.05*zs;
[F,T] = meshgrid(f,t);
L = 10;
xmat = sin(2*pi*F.*T);
phase = 2*pi*F.*T;
phase = phase./max(max(phase));
theta = asin(xmat./L);
zmat = -cos(2*pi*theta);
figure;
set(0,'defaultfigurevisible','off')
surf(xs+xmat(1,1),ys+0.2*1,zs+zmat(1,1),zeros(size(zs)))
set(gca,'view',[0 5])
zlim([-1.4 -0])
xlim([-1.05 1.05])
ylim([-0.2 10])
set(gca,'clim',[0 1]);
axis off
axis equal
shading flat
camlight
pos = get(gca,'position');
close all
for tk = 1:length(t)
for j = 1:length(f)
surf(xs+xmat(tk,j),ys+0.2*j,zs+zmat(tk,j),phase(tk,j)*ones(size(zs)))
hold on
end
axis off
axis equal
shading flat
camlight
set(gca,'view',[0 5])
zlim([-1.4 -0])
xlim([-1.05 1.05])
ylim([-0.2 10])
set(gca,'clim',[0 1]);
set(gca,'position',pos);
fn = sprintf('img2/%05d.png',tk);
saveas(gcf,fn);
tk
close
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment