I ran into an interesting but rather unpleasant problem.
I am trying to integrate a function that was calculated from a dataset. Data can be found here: Link to sample.txt .
I start by setting a string to my data. this can be done linear with approxfun or nonlinear with splinefun . In my example below, I use the latter. Now when I try to integrate the installed function, I encounter an error
maximum number of subdivisions reached
but when I increase the unit, I get
From the values ββin my code example, you can see that for this particular dataset the threshold is 754-> 755.
My colleague has no problem integrating this dataset into Matlab. Is there a way to manipulate my data for integration? Is there another method for numerical integration in R?

data<-read.table('sample.txt',sep=',') colnames(data)<-c('wave','trans') plot(data$wave,data$trans,type='l') trans<- -1 * log(data$trans) plot(data$wave,trans,type='l') fx.spline<-splinefun(data$wave,trans)
Martin h
source share