Integrantes del Grupo
Bayron Alfredo Escalante #20231002598
Carlos Enrique Aguilar Aguilar #20241001300
Cecilia Devaney Zuniga Flores #20212000921
Manuel Alejandro Mendoza Espinoza #20221004908
María Fernanda Burdet Barahona #20241004209
Rommel Edgardo Zavala Murillo #20241001084
library(readxl)
library(ggplot2)
installed.packages()["ggplot2", "Version"]
## [1] "3.5.1"
Datos <- read_excel("C:/Users/Intel Gaming/Documents/proyecto R#/Tabla_datos_r#.xlsx")
Datos
## # A tibble: 85 × 2
## Tiempo Grados
## <dbl> <dbl>
## 1 0.05 66
## 2 0.1 66
## 3 0.15 66
## 4 0.2 66
## 5 0.25 66
## 6 0.3 66
## 7 0.35 66
## 8 0.4 66
## 9 0.45 66
## 10 0.5 66
## # ℹ 75 more rows
tiempo <- Datos$Tiempo
temperatura <- Datos$Grados
T0 <- max(temperatura)
Tm <- min(temperatura)
model <- nls(temperatura ~ Tm + (T0 - Tm) * exp(-r * tiempo),
start = list(Tm = Tm, T0 = T0, r = 0.1))
params <- coef(model)
Tm_est <- params["Tm"]
r_est <- params["r"]
T_m <- T0
neg_rTm <- -r_est * T_m
pos_rTm <- r_est * T_m
cat("Temperatura ambiente estimada (Tm):", Tm_est, "\n")
## Temperatura ambiente estimada (Tm): 31.04053
cat("Valor de r estimado:", r_est, "\n")
## Valor de r estimado: 0.04365685
cat("-r * T_m:", neg_rTm, "\n")
## -r * T_m: -2.881352
cat("+r * T_m:", pos_rTm, "\n")
## +r * T_m: 2.881352
fit_data <- data.frame(
tiempo = tiempo,
temperatura = temperatura,
ajuste = Tm_est + (T0 - Tm_est) * exp(-r_est * tiempo)
)
ggplot(Datos, aes(x = Tiempo, y = Grados)) +
geom_point(color = "black") +
geom_line(data = fit_data, aes(x = tiempo, y = ajuste), color = "green") +
labs(x = "Tiempo (mins)", y = "Temperatura (Grados C)", title = "Temperatura en Funcion del Tiempo") +
theme_minimal()