2011-05-24, 02:37 AM
shouri Wrote:R
Code:seq(1:10)
You only need to write '1:10' and it'll output them. Probably works in MATLAB too, though I don't have a copy.
If you want it to actually print them,
Code:
cat(1:10)Code:
cat(1:10,sep="\n")Getting into stupider methods of doing it in R...
Code:
y <- c(1:10,0)
x <- 1:11
c <- (lm(y ~ poly(x,10,raw=TRUE)))$coefficients
f <- function(x) {
return(c[1] + c[2]*x + c[3]*x^2 + c[4]*x^3 + c[5]*x^4
+ c[6]*x^5 + c[7]*x^6 + c[8]*x^7 + c[9]*x^8
+ c[10]*x^9 + c[11]*x^10)
}
f(1:10)
