- /
-
Warped space-time
on 9 Nov 2023
- 7
- 26
- 0
- 0
- 469
drawframe(1);
Write your drawframe function below
function drawframe(f)
cla
x = linspace(0,4*pi,200);
nLines = 12;
theta = 2*pi*(1:nLines)/nLines;
hgtRoot = hgtransform;
hgt = zeros(1,nLines);
for i = 1:nLines
hgt(i) = hgtransform(Parent=hgtRoot);
y = 1/10*x.*x.*x.*besselj(1,x+i/2);
line(x,y,Parent=hgt(i),Color="green",LineWidth=2);
R = makehgtform('zrotate', theta(i));
set(hgt(i),Matrix=R)
end
axis equal
axis off
grid on
axis(12*[-1 1 -1 1])
alpha = interp1([0 48],[0 48*2*pi/nLines],f)
R = makehgtform('zrotate', alpha);
set(hgtRoot,Matrix=R)
set(gcf,Color="black")
end
Animation
![](/responsive_image/300/300/0/0/0/cache/matlabcentral/communitycontests/uploaded_files/14727/animation.gif?a=true)