1)

Questão 1

MRT_1F <-c(517.1468515630205, 85.13094142168089, 30.333207896694553, 12.694776264558937, 3.3041601673945418, 1.1823111717498882, 1.1892293502386786)

MRT_3F <-c(156.68929936163462, 11.540837783562276, 0.4512835621696538, 0.4509797929766453, 0.4502068233039181, 0.4496185276300172, 0.4543157082191288)

MRT_5F <-c(83.90319666471157, 0.3068151086494968, 0.30522314133037304, 0.3072588968084928, 0.30655265997285697, 0.3055812715727718, 0.3053297166713006)

MRT_10F <-c(29.55430642951759, 0.19832832665772515, 0.1971923924717474, 0.19796648905716516, 0.19615594370806338, 0.2034569237883263, 0.19617420889447737)

MRT_15F <-c(11.317736530583566, 0.167364215666193, 0.16172168266811013, 0.16701085329580515, 0.1598052657153692, 0.1645934043532696, 0.16216563797118075)

MRT_sem_F <-c(11.93430909937736, 0.6095414637034009, 0.6060645101029295, 0.612167181646899, 0.6146761002685637, 0.6096747087200697, 0.6125810476877268)

clock <- c(0.1, 0.5, 1, 1.5, 2, 2.5, 3)


#plot(x,y,type="l",pch=3,cex=2,col="#E6E6E6")
#plot(x,y,type="l",pch=3,cex=2,col="#666666")
#plot(MRT_1F,MRT_3F,MRT_10F)

plot(MRT_1F,type = "o", pch = 4,
     cex= 1, col = "black",
     xlab = "Time between Things requests (seconds)",
     ylab = "Response Time (sec.)",
     main ="",
     cex.lab=1, cex.axis = 1,
     cex.main = 1,
     xlim = c(0, 7),
     ylim = c(0, 600)
     )

lines(MRT_3F,type = "o", pch = 15, col = "yellow")
lines(MRT_5F,type = "o", pch = 1, col = "red")
lines(MRT_10F,type = "o", pch = 2, col = "blue")
lines(MRT_15F,type = "o",  pch = 5,col = "purple")
lines(MRT_sem_F,type = "o",  pch = 4,col = "green")

legend("topright", pch = c(4,15,1,2,5,4),
       col = c("black", "yellow", "red","blue", "purple","green"),
       legend = c("1 Fogs","3 Fogs","5 Fogs", "10 Fogs", "15 Fogs","w/o Fog"))

par(mfrow = c(3,2))


cores <- c("#E6E6E6","#666666")

barplot(matriz_intercalada1 <- matrix(c(MRT_sem_F, MRT_1F), nrow = 2, byrow = TRUE),
        ylab = "response time (s)",
        xlab = "Time between Things request",
        log = "y",
        names.arg = c("0.1","0.5","1","1.5","2.0","2.5","3"),
        beside = T,
        col = cores
        )
legend("topright",pch = c(15, 15),col = cores, legend = c("w/o Fog", "1 Fog"))


barplot(matriz_intercalada2 <- matrix(c(MRT_sem_F, MRT_3F), nrow = 2, byrow = TRUE),
        ylab = "response time (s)",
        xlab = "Time between Things request",
        log = "y",
        names.arg = c("0.1","0.5","1","1.5","2.0","2.5","3"),
        beside = T,
        col = cores
)
legend("topright",pch = c(15, 15),col = cores, legend = c("w/o Fog", "3 Fog"))

barplot(matriz_intercalada2 <- matrix(c(MRT_sem_F, MRT_5F), nrow = 2, byrow = TRUE),
        ylab = "response time (s)",
        xlab = "Time between Things request",
        log = "y",
        names.arg = c("0.1","0.5","1","1.5","2.0","2.5","3"),
        beside = T,
        col = cores
)
legend("topright",pch = c(15, 15),col = cores, legend = c("w/o Fog", "5 Fog"))

barplot(matriz_intercalada2 <- matrix(c(MRT_sem_F, MRT_10F), nrow = 2, byrow = TRUE),
        ylab = "response time (s)",
        xlab = "Time between Things request",
        log = "y",
        names.arg = c("0.1","0.5","1","1.5","2.0","2.5","3"),
        beside = T,
        col = cores
)
legend("topright",pch = c(15, 15),col = cores, legend = c("w/o Fog", "10 Fog"))

barplot(matriz_intercalada2 <- matrix(c(MRT_sem_F, MRT_15F), nrow = 2, byrow = TRUE),
        ylab = "response time (s)",
        xlab = "Time between Things request",
        log = "y",
        names.arg = c("0.1","0.5","1","1.5","2.0","2.5","3"),
        beside = T,
        col = cores
)
legend("topright",pch = c(15, 15),col = cores, legend = c("w/o Fog", "15 Fog"))

## Questão 2