Advertisement
zrhans

obliquo.f90

Jun 18th, 2015
481
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program obliquo
  2. implicit none
  3. real, parameter :: PI = 3.14159265359, g = -9.80665 !m/sĀ²
  4. integer, parameter :: v0 = 10 ! modulo da velocidade de lancamento, em m/s
  5.  
  6. real :: x = 0.0, y = 0.0 ! posicoes x e y do objeto
  7. real :: x0 = 0.0   ! coordenada x de lancamento
  8. real :: y0 = 1.0   ! coordenada y de lancamento
  9. real :: theta = 45 ! angulo de lancamento
  10. real :: vx0 = 0.0  ! velocidade inicial na direcao x
  11. real :: vy0 = 0.0  ! velocidade inicial na direcao y
  12. real :: t = 0.0    ! tempo em segundos
  13. real :: dt = 0.2   ! intervalo de tempo entre calculos sucessivos
  14.  
  15. theta = theta * PI / 180 ! angulo de lancamento em radianos
  16. vx0 = v0 * cos(theta)    ! direcao x
  17. vy0 = v0 * sin(theta)    ! direcao y
  18.  
  19.  
  20. print '( 3(8x,a)  )','t(s)','x(m)' ,'y(m)'
  21. print '( 40("-") )'
  22. print*,y
  23. ! Laco (repeticao) enquanto y > 0
  24. do while( y .ge. 0.0)
  25.     x = x0 + vx0 * t
  26.     y = y0 + vy0 * t + 0.5 * g * t**2
  27.     if ( y .lt. 0.0 ) go to 100
  28.     write(*,*)t,x,y
  29.     t = t + dt
  30. end do
  31.  
  32. 100 continue
  33.  
  34. end program
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement