Displaying 1 result from an estimated 1 matches for "contrastfit".
2001 Feb 19
2
problems sourcing in vs interactive
...he R
window it works fine.
calib<-function()
{
contrast<-c(.01,.02,.0325,.055,.0775,.1,.125,.15,.175,.2)
energy<-c(3.53189e-5,.000141275,.000373056,.0010684,.00212134,.00353189,
.00551857,.00794675,.0108164,.0141275)
plot(contrast,energy)
fit<-nls(energy~a*contrast^2,start=list(a=.01))
contrastfit<-seq(min(contrast),max(contrast),length=40)
energyfit<-coef(fit)[[1]]*contrastfit^2
lines(spline(contrastfit,energyfit))
list(summary(fit))
#for these data, energy=.3532 * contrast^2 s deg^s
}
What is wrong and how to fix? The problem seems to originate in nls()
since the plot is produced OK...