VECTOR DE VELOCIDAD

Introducir las posiciones p1 y p2 (x,y) y el tiempo t

Posicion_1 <- c(100,200)
Posicion_2 <- c(120,210)
tiempo<- 2
desplazamiento<- Posicion_2-Posicion_1
(velocidad_x<- desplazamiento[1]/tiempo)
## [1] 10
(velocidad_y<- desplazamiento[2]/tiempo)
## [1] 5
(velocidad = sqrt(velocidad_x^2 + velocidad_y^2))
## [1] 11.18034
(tangente_del_angulo<- velocidad_y/velocidad_x)
## [1] 0.5
(angulo <- atan(tangente_del_angulo))# en radianes
## [1] 0.4636476
(direccion<- angulo*180/pi)# en grados
## [1] 26.56505

Including Plots

##  [1] 20.000000 10.000000  6.666667  5.000000  4.000000  3.333333  2.857143
##  [8]  2.500000  2.222222  2.000000  1.818182  1.666667  1.538462  1.428571
## [15]  1.333333  1.250000  1.176471  1.111111  1.052632  1.000000
##  [1] 10.0000000  5.0000000  3.3333333  2.5000000  2.0000000  1.6666667
##  [7]  1.4285714  1.2500000  1.1111111  1.0000000  0.9090909  0.8333333
## [13]  0.7692308  0.7142857  0.6666667  0.6250000  0.5882353  0.5555556
## [19]  0.5263158  0.5000000
##  [1] 22.360680 11.180340  7.453560  5.590170  4.472136  3.726780  3.194383
##  [8]  2.795085  2.484520  2.236068  2.032789  1.863390  1.720052  1.597191
## [15]  1.490712  1.397542  1.315334  1.242260  1.176878  1.118034

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.