- /
-
The HEAT is on!
on 9 Oct 2024
- 10
- 84
- 0
- 0
- 646
Cite your audio source here (if applicable):
drawframe(96);
Write your drawframe function below
function drawframe(f)
n = 3640;
xPos = 2*rand(n,1) - 1;
yPos = 2*rand(n,1) - 1;
xSpeed = zeros(n,1);
ySpeed = zeros(n,1);
T = 9.6/2;
dt = 0.01;
nSteps = T/dt;
bypass = nSteps/96;
p = 0;
ax = axes('Position',[0,0,1,1]);
col = [ones(n,1), abs(xPos)./max(xPos), abs(yPos)./max(yPos)];
plt = scatter(xPos,yPos,20,col,'filled','Marker','o');
ax.Color = 'k';
xlim([-3,3])
ylim([-5,1.1])
for i = 1:nSteps
% Get Force
xForce = -tan(3*(xPos).*2.*cos(0.8.*yPos));
yForce = -0.5.*cos(5*yPos.*xPos).^4;
% Integrate
xSpeed = xSpeed + xForce*dt;
ySpeed = ySpeed + yForce*dt;
xPos = xPos + xSpeed*dt;
yPos = yPos + ySpeed*dt;
% pick frame
if mod(i,bypass)==0
p = p + 1;
plt.XData = xPos;
plt.YData = yPos;
end
if p == f
drawnow
break
end
end
end
Movie
Audio
This submission does not have audio.