Guest User

Untitled

a guest
Jun 19th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. pendulum <- function(x,rad, xlimit = c(-1.5, 1.5){
  2. if(x > xlimit[2] | x < xlimit[1]) warning("x is out of range ", xlimit)
  3. myfs::setMargin(0,0,0,0)
  4. plot(1, type = "n", ann = F, xlim = xlimit + c(-1, 1) ,ylim = xlimit + c(-1, 1))
  5. rect(xlimit[1], -1, xlimit[1] - 0.1, 0, col = 8, border = 8)
  6. rect(xlimit[2], -1, xlimit[2] + 0.1, 0, col = 8, border = 8)
  7. rect(xlimit[1] - 0.5, 0.05, xlimit[2] + 0.5, -0.05, col = 8, border = 8)
  8.  
  9. polygon(c(x, x + cos(rad),
  10. x + cos(rad) + cos(rad - pi / 2) * 0.1, x + cos(rad - pi / 2) * 0.1),
  11. c(0, sin(rad), sin(rad) + sin(rad - pi / 2) * 0.1, sin(rad - pi / 2) * 0.1), col = 1)
  12. }
Add Comment
Please, Sign In to add comment