Skip to content

Instantly share code, notes, and snippets.

@felixlindemann
Created November 12, 2014 13:32
Show Gist options
  • Save felixlindemann/d60e9978747cda5d8e08 to your computer and use it in GitHub Desktop.
Save felixlindemann/d60e9978747cda5d8e08 to your computer and use it in GitHub Desktop.
Kosten für Carsharing in Wuppertal
cf <- 30
cm <- c(0,3,10,25, 10)
cmf <- matrix(c(
2.5, 0.24,
1.9,0.32,
1.7,0.24,
1.5, 0.21,
2.25, 0.26
),
byrow = FALSE, nrow = 2)
FP.EK <- 15/4
FP.DD <- 100 / 6
FP.K <- 120 / 7
lab <- c("Campus", "Start", "Aktiv", "Comfort", "Flinkster")
max.mietdauer <- 16
h<- seq(0,max.mietdauer, by = 0.1)
index <- 1 # cambio - "Campus"
b<- cm[index]
m<- (cmf[1,index] + cmf[2,index] * FP.EK )
m1 <- m
b1 <- b
costs.EK <- cm[index] + m *h
plot(h,costs.EK, type="l", xlab = "h", ylab = "Kosten in €", main = "Kosten für Car-Sharing in Wuppertal", col = index)
abline(h=0)
abline(v=0)
max(costs.EK)
index <- 2 # cambio - "Start"
b<- cm[index]
m<- (cmf[1,index] + cmf[2,index] * FP.EK )
costs.EK <- cm[index] + m *h
lines(h,costs.EK, col = index)
x<- (b1-b) / (m - m1)# intersect Start / Campus
x
abline(v=x)
max(costs.EK)
m1 <- m
b1 <- b
index <- 3 # cambio - "Aktiv",
b<- cm[index]
m<- (cmf[1,index] + cmf[2,index] * FP.EK )
costs.EK <- cm[index] + m *h
lines(h,costs.EK, col = index)
x<- (b1-b) / (m - m1)# intersect Start / Campus
x
abline(v=x)
max(costs.EK)
m1 <- m
b1 <- b
index <- 4 # cambio - "Comfort"
b<- cm[index]
m<- (cmf[1,index] + cmf[2,index] * FP.EK )
costs.EK <- cm[index] + m *h
lines(h,costs.EK, col = index)
x<- (b1-b) / (m - m1)# intersect Start / Campus
x
abline(v=x)
max(costs.EK)
m1 <- m
b1 <- b
index <- 5 # Flinkster
b<- cm[index]
m<- (cmf[1,index] + cmf[2,index] * FP.EK )
costs.EK <- cm[index] + m *h
lines(h,costs.EK, col = index, lwd=3)
max(costs.EK)
m1 <- m
b1 <- b
temp <- legend("bottomright", legend = lab,
lty = rep(1,index), lwd = rep(2,index),
xjust = 1, yjust = 1,
col=1:index,
title = "Tarife")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment