g = 9.8 # m/s^s a = -g vy0 = 10 # m/s vx0 = 10 # m/s tM = 2*vy0/g t = 0 # s x0 = 0 # m y0 = 0 # m xM = tM*vx0 plot(x0, y0, xlim=c(0, vx0*tM), ylim=c(0, vy0^2/(2*g)*1.05), xaxs='i', yaxs='i', xlab='x (m)', ylab='y (m)', pch=19, col='blue', asp=TRUE, main="Traiettoria (y vs x) [vy0(m/s): 10, 9, 8, 7 , 6, 5]" ) abline(h=0, lty=2) Dt = 0.02 # s while(1) { Sys.sleep(Dt) t = t + Dt points(vx0 * t, y0 + vy0*t + a/2 * t^2, pch=19, col='blue') if(t > tM) break } #---------------------------------------------------------- Sys.sleep(1) vy0 = 9.0 # m/s t = 0 # s points(vx0 * t, vy0 + a * t, pch=19, col='gray') while(1) { Sys.sleep(Dt) t = t + Dt points(vx0 * t, y0 + vy0*t + a/2 * t^2, pch=19, col='gray') if(t > tM) break } #---------------------------------------------------------- Sys.sleep(1) vy0 = 8 # m/s t = 0 # s points(vx0 * t, vy0 + a * t, pch=19, col='gray') while(1) { Sys.sleep(Dt) t = t + Dt points(vx0 * t, y0 + vy0*t + a/2 * t^2, pch=19, col='gray') if(t > tM) break } #---------------------------------------------------------- Sys.sleep(1) vy0 = 7 # m/s t = 0 # s points(vx0 * t, vy0 + a * t, pch=19, col='gray') while(1) { Sys.sleep(Dt) t = t + Dt points(vx0 * t, y0 + vy0*t + a/2 * t^2, pch=19, col='gray') if(t > tM) break } #---------------------------------------------------------- Sys.sleep(1) vy0 = 6 # m/s t = 0 # s points(vx0 * t, vy0 + a * t, pch=19, col='gray') while(1) { Sys.sleep(Dt) t = t + Dt points(vx0 * t, y0 + vy0*t + a/2 * t^2, pch=19, col='gray') if(t > tM) break } #---------------------------------------------------------- Sys.sleep(1) vy0 = 5 # m/s t = 0 # s points(vx0 * t, vy0 + a * t, pch=19, col='cyan') while(1) { Sys.sleep(Dt) t = t + Dt points(vx0 * t, y0 + vy0*t + a/2 * t^2, pch=19, col='cyan') if(t > tM) break }