• Remix
  • Share
  • New Entry

on 26 Oct 2021
  • 4
  • 431
  • 0
  • 0
  • 207
g=9.81;
dt=1e-4;
y=zeros(1e5,1);
y(1)=10;
v=0;
for i=2:length(y)
v=v-g*dt;
y(i)=max(0,y(i-1)+v*dt);
if y(i)<=0
v=-v*0.75;
end
end
plot((1:1e5)*dt,y,3e4*dt,y(3e4),'o','markerfacecolor',[1 0.5 0],'markersize',15); grid on; box on;
Remix Tree