R/get.r.R

Defines functions get.r

get.r = function(phi, egg) {
  # Get the value of r for a given angle phi
  optim.r = function(r) {
    z.hat = normalise(r*cos(phi), -egg$length/2, egg$length/2, 0, 1)
    x.obs = r*sin(phi)
    x.exp = get.d(z.hat, egg)
    return((x.obs - x.exp)^2)
  }
  opt = optimize(f=optim.r, interval=c(0,egg$length/2), tol=1e-10)
  r = opt$minimum
  return(r)
}

Try the egg package in your browser

Any scripts or data that you put into this service are public.

egg documentation built on May 2, 2019, 5:55 p.m.