Hey y'all,
Not exactly C++ but I heard the R IDE is based off of it so please help 🙂
I'm working with a data set that looks like so

I've tried everything to get the envelope function (esentially a function that estimates the the outside function containing the points) but have no idea where to go from here.
This is what I have to far, and using reslm2 works amazing once I have points that correlate because it uses a second harmonic of sine and cosine waves, but my issue is I would need only the outer values and none of the inner values. This is for work with non-destructive evaluation so I would doing it on hundreds of thousands if not millions of points, so it needs to be able to run quickly, if anyone has any advice please let me know, I'd love to hear solution!
Not exactly C++ but I heard the R IDE is based off of it so please help 🙂
I'm working with a data set that looks like so

I've tried everything to get the envelope function (esentially a function that estimates the the outside function containing the points) but have no idea where to go from here.
Code:
my_data <- read.delim(file.choose("pipe2a_00.txt"),sep=",")
t <- as.numeric(unlist(head(my_data[c(1)],20000)))
y <- as.numeric(unlist(head(my_data[c(2)],20000)))
ssp <- spectrum(y)
per <- 1/ssp$freq[ssp$spec==max(ssp$spec)]
plot(t, y, type='p')
reslm2 <- lm(ev ~ sin(2*pi/per*t)+cos(2*pi/per*t)+sin(4*pi/per*t)+cos(4*pi/per*t))
summary(reslm2)
lines(fitted(reslm2)~t,col='red')
This is what I have to far, and using reslm2 works amazing once I have points that correlate because it uses a second harmonic of sine and cosine waves, but my issue is I would need only the outer values and none of the inner values. This is for work with non-destructive evaluation so I would doing it on hundreds of thousands if not millions of points, so it needs to be able to run quickly, if anyone has any advice please let me know, I'd love to hear solution!
Last edited: