Adrià Vilanova Martínez | 8d6bb62 | 2023-03-30 21:23:52 +0200 | [diff] [blame] | 1 | mec2 <- 510.999 |
| 2 | r <- 0.05 |
| 3 | ee <- 1.60e-19 |
| 4 | c <- 299792348 |
| 5 | eV <- 6.24e18 |
| 6 | |
| 7 | table <- read.table('dades/dades.txt', sep="\t", dec='.', header=TRUE) |
| 8 | table$LogIntensitatReal <- log(table$IntensitatReal) |
| 9 | table$CampMagneticSq <- table$CampMagnetic^2 |
| 10 | table$E <- (sqrt((ee*c*(table$CampMagnetic/1000)*r*eV/1000)^2 + mec2^2) - mec2)/1000 |
| 11 | table$ESq <- table$E^2 |
| 12 | |
| 13 | tablefit <- table[8:17,] |
| 14 | |
| 15 | fit <- lm(IntensitatReal ~ E + ESq, data = tablefit) |
| 16 | summary(fit) |
| 17 | fit_coef <- coef(fit) |
| 18 | |
| 19 | svg(file='output/p1b.svg', width=6, height=5) |
| 20 | plot(table$E, table$IntensitatReal, xlab="Energia (MeV)", ylab="Intensitat (s^-1)") |
| 21 | curve(fit_coef[1] + fit_coef[2]*x + fit_coef[3]*x*x, col = "mediumorchid2", add = TRUE) |
| 22 | dev.off() |
| 23 | |
| 24 | svg(file='output/p1b2.svg', width=6, height=5) |
| 25 | plot(table$CampMagnetic, table$E, xlab="Camp magnètic (mT)", ylab="Energia (MeV)") |
| 26 | dev.off() |
| 27 | |
| 28 | Emax <- -fit_coef[2]/(2*fit_coef[3]) |
| 29 | Emax |