# Mathematical pendulum m l y'' + m g sin(y) = 0
pendel <- function(t, y) -sin(y[1])
sol <- newmark(pendel, 0, 4*pi, c(pi/4, 0))
## Not run:
# plot(sol$t, sol$y[, 1], type="l", col="blue",
# xlab="Time", ylab="Elongation/Speed", main="Mathematical Pendulum")
# lines(sol$t, sol$y[, 2], col="darkgreen")
# grid()## End(Not run)
Run the code above in your browser using DataLab