SHARE
TWEET

Untitled

a guest Aug 19th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. x <- c(5,6)
  2. y <- c(0.45,0.50)
  3.  
  4. interp <- approx(x,y)
  5.  
  6. plot(x,y,pch=16,cex=2)
  7. points(interp,col='red')
  8.      
  9. approx(x,y,xout=5.019802)
  10. $x
  11. [1] 5.019802
  12.  
  13. $y
  14. [1] 0.4509901
  15.      
  16. x = c(5,6)
  17. y = c(0.45, 0.50)
  18. m <- (y[2] - y[1]) / (x[2] - x[1]) # slope formula
  19. b <- y[1]-(m*x[1]) # solve for b
  20. m*(5.019802) + b
  21.  
  22. # same answer as the approx function
  23. [1] 0.4509901
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top