Adrià Vilanova MartÃnez | 5b56f8b | 2023-03-15 22:25:23 +0100 | [diff] [blame^] | 1 | file_path <- 'data.txt' |
| 2 | |
| 3 | xA <- 100 |
| 4 | xB <- 500 |
| 5 | |
| 6 | c <- 299792458 # m/s |
| 7 | h <- 6.62607015e-34 # m^2 kg s^{-1} |
| 8 | |
| 9 | data <- read.table(file_path, sep="\t", header=TRUE) |
| 10 | data$TA <- data$VA / data$VSenseMostra |
| 11 | data$TB <- data$VB / data$VSenseMostra |
| 12 | tmaxA <- max(data$TA) |
| 13 | tmaxB <- max(data$TB) |
| 14 | data$AlphaASquared <- ((1/xA)*log(tmaxA/data$TA))^2 |
| 15 | data$AlphaBSqrt <- sqrt((1/xB)*log(tmaxB/data$TB)) |
| 16 | data$E <- h*c/(data$Longitud * 1e-9) * 6.242e18 # eV |
| 17 | |
| 18 | dataFitA = data[16:18,] |
| 19 | dataFitB1 <- data[56:62,] |
| 20 | dataFitB2 <- data[33:55,] |
| 21 | |
| 22 | fitA = lm(AlphaASquared~E, data = dataFitA) |
| 23 | summary(fitA) |
| 24 | |
| 25 | fitB1 = lm(AlphaBSqrt~E, data = dataFitB1) |
| 26 | summary(fitB1) |
| 27 | |
| 28 | fitB2 = lm(AlphaBSqrt~E, data = dataFitB2) |
| 29 | summary(fitB2) |
| 30 | |
| 31 | plot(dataFitA$E, dataFitA$AlphaASquared) |
| 32 | |