Lab moderna: add p4
Change-Id: I56673d05625f628fbb33acfad3b482e3158cbb42
diff --git a/quad12/labmoderna/p4a/dades/dades.txt b/quad12/labmoderna/p4a/dades/dades.txt
new file mode 100644
index 0000000..b199a24
--- /dev/null
+++ b/quad12/labmoderna/p4a/dades/dades.txt
@@ -0,0 +1,10 @@
+Absorbent GruixMassic IntensitatReal
+14 324.2 30.80833333
+14 324.2 30.89
+12 216.2 56.15
+10 94.6 83.40
+8 43.2 106.20
+7 31.1 113.01
+6 25.7 113.86
+0 0 123.59
+
diff --git a/quad12/labmoderna/p4a/output/.gitignore b/quad12/labmoderna/p4a/output/.gitignore
new file mode 100644
index 0000000..e9575a3
--- /dev/null
+++ b/quad12/labmoderna/p4a/output/.gitignore
@@ -0,0 +1,3 @@
+*.png
+*.svg
+*.pdf
diff --git a/quad12/labmoderna/p4a/r/main.r b/quad12/labmoderna/p4a/r/main.r
new file mode 100644
index 0000000..41f7560
--- /dev/null
+++ b/quad12/labmoderna/p4a/r/main.r
@@ -0,0 +1,10 @@
+table <- read.table('dades/dades.txt', sep="\t", dec='.', header=TRUE)
+table$LogIntensitatReal <- log(table$IntensitatReal)
+
+fit <- lm(LogIntensitatReal~GruixMassic, data = table)
+summary(fit)
+
+svg(file='output/p1a.svg', width=6, height=5)
+plot(table$GruixMassic, table$LogIntensitatReal, xlab="Gruix màssic (mg/cm^2)", ylab="log(Intensitat · s)")
+abline(fit, col = "mediumorchid2")
+dev.off()