# Create vertical parabola with some noise
parP <-c(.5,0,0,2,-1,4)
xp <- seq(-5,5,by=0.05)
partest <-createConic(xp,param = parP,ranFun = rnorm, noise = 1)
plot(partest, pch= '.',asp=TRUE, cex=3)
# rotate the data
partestr <-xyrot(partest,theta = -.35)
points(partestr,col='green',pch='.',cex=3)
# do the fit
parfit <-fitParabola(partestr)
points(parfit$vertex,pch='X',col='blue')
parout <- createConic(xp,parfit$parA)
lines(parout,col='red')
Run the code above in your browser using DataLab