hydro:inghy:exchange
Dies ist eine alte Version des Dokuments!
Inhaltsverzeichnis
Ingenieurhydrologie Modellierung
Lineare Regression rechnen
- |Lin-Regr.r
#' --- #' title: "Lineae Regression" #' author: "C. Kuells" #' date: "9. Mai, 2015" #' --- x <- c(-2, -1, -0.8, -0.3, 0, 0.5, 0.6, 0.7, 1, 1.2) y <- c(1.9, 0.6, 0.5, 0.8, -0.4, -0.9, -0.7, -0.1, -1.7, -0.2) fm <- lm(y ~ x) #+ fig.width=5, fig.height=5 plot(x, y, xlim = c(-3, 3), ylim = c(-3, 3), pch = 19) fitted.values(fm) residuals(fm) #+ fig.width=5, fig.height=5 plot(x, y, xlim = c(-3, 3), ylim = c(-3, 3), pch = 19) abline(fm, col = "red")
Datein einlesen
wd <- getwd() setwd("C:\HydroPro\R+") klima <- read.csv(file="c:/HydroPro/R+/fuhlsbuettel.txt", header=TRUE, sep=";", na.string="-999") summary(klima) attach(klima)
Kontrollstrukturen
if (bed1 < eps) { a3 <- a1 + a2 else { a3 <- 0 }
for (i in 1:length(N)) { if (N[i] <= Va) { Nc[i] <- 0.0 } else { Nc[i] <- N[i]-Va } }
Erstes Modell
#' --- #' title: Hydrologisches Modell #' author: "C. Kuells" #' date: "9. Mai, 2015" #' --- setwd("C:\\HydroPro\\R+") klima <- read.csv(file="fuhlsbuettel.txt", header=TRUE, sep=";", na.strings=" -999") # Fehlwerte richtig einlesen: man muss na.strings=" -999" eingeben - mit den zwei Leerzeichen davor! summary(klima) attach(klima) N <- NIEDERSCHLAGSHOEHE Nc <- N Flaeche <- 640 # km2 A <- 0.08 # Abflusskoeffizient Va <- 3 # mm Anfangsverlust bei 1 bis 3 mm pro Tag # return kann weggelassen werden! for (i in 1:length(N)) { if (N[i] <= Va) { Nc[i] <- 0.0 } else { Nc[i] <- N[i]-Va } } Q <- Nc*A*(Flaeche*1000000)*1/1000*1/86400 # Einheitenumwandlung Flaeche m2 -> km2, Volumen l-> qm, Zeit Tag -> Sekunde plot(Q, ylim = c(0, 10))
/usr/www/users/uhydro/doku/data/attic/hydro/inghy/exchange.1497289909.txt.gz · Zuletzt geändert: 2024/04/10 10:15 (Externe Bearbeitung)