Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Set working directory with folder containing all .txt files for inspection
- # Add all .txt files to the global environment
- allruns<-list.files(pattern=".txt")
- for(i in 1:length(allruns))assign(allruns[i],read.table(allruns[i]))
- x<-run1.txt$V1
- y1<-run1.txt$V2
- y2<-run2.txt$V2
- y3<-run3.txt$V2
- # ...
- yn<-runn.txt$V2
- run1<-lm(y1~x)
- run2<-lm(y2~x)
- run3<-lm(y3~x)
- # ...
- runn<-lm(yn~x)
- plot(x,y1,col="transparent",main="LSV Solid Film", xlab = "potential(V)",ylab="current(A)", xlim=rev(range(x)),ylim=range(c(y3,yn)))
- par(new=TRUE)
- plot(x,y2,col="transparent",main="LSV Solid Film", xlab = "potential(V)",ylab="current(A)", xlim=rev(range(x)),ylim=range(c(y3,yn)))
- par(new=TRUE)
- plot(x,y3,col="transparent",main="LSV Solid Film", xlab = "potential(V)",ylab="current(A)", xlim=rev(range(x)),ylim=range(c(y1,yn)))
- # ...
- par(new=TRUE)
- plot(x,yn,col="transparent",main="LSV Solid Film", xlab = "potential(V)",ylab="current(A)", xlim=rev(range(x)),ylim=range(c(y1,yn)))
- #To obtain all LINEST lines (one for each scan, on the single graph):
- abline(run1,col=””, lwd=1)
- abline(run2,col=””,lwd=1)
- abline(run3,col=””,lwd=1)
- # ...
- abline(runn,col=””,lwd=1)
- # Then to get each LINEST equation:
- summary(run1)
- summary(run2)
- summary(run3)
- # ...
- summary(runn)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement