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