[chronojump] Minor fix
- From: Xavier Padullés <xpadulles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Minor fix
- Date: Wed, 29 Mar 2017 19:40:59 +0000 (UTC)
commit 4faf3ec14d6a629e852790bcca34e8b755374fc9
Author: Xavier Padullés <x padulles gmail com>
Date: Wed Mar 29 21:39:17 2017 +0200
Minor fix
r-scripts/sprintPhotocells.R | 4 +---
r-scripts/sprintUtil.R | 12 ++++++------
2 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/r-scripts/sprintPhotocells.R b/r-scripts/sprintPhotocells.R
index 36eb4c7..f8c2b32 100644
--- a/r-scripts/sprintPhotocells.R
+++ b/r-scripts/sprintPhotocells.R
@@ -83,8 +83,6 @@ drawSprintFromPhotocells <- function(sprintDynamics, splitTimes, positions, titl
# Fitted speed plotting
par(new=T)
- print(time)
- print(sprintDynamics$v.fitted)
plot(time, sprintDynamics$v.fitted, type = "l", xlab="", ylab = "", ylim = c(0, max(c(avg.speeds,
sprintDynamics$Vmax) + 1)), yaxs= "i", xaxs = "i") # Fitted data
text(4, sprintDynamics$Vmax.fitted/2, substitute(v(t) == Vmax*(1-e^(-K*t)),
list(Vmax=round(sprintDynamics$Vmax.fitted, digits=3), K=round(sprintDynamics$K.fitted, digits=3))), pos=4,
cex=2)
@@ -99,6 +97,7 @@ drawSprintFromPhotocells <- function(sprintDynamics, splitTimes, positions, titl
{
par(new=T)
plot(time, sprintDynamics$f.fitted, type="l", axes = FALSE, xlab="", ylab="", col="blue",
ylim=c(0,sprintDynamics$fmax.fitted), yaxs= "i", xaxs = "i")
+
}
#Power plotting
@@ -106,7 +105,6 @@ drawSprintFromPhotocells <- function(sprintDynamics, splitTimes, positions, titl
{
par(new=T)
plot(time, sprintDynamics$p.fitted, type="l", axes = FALSE, xlab="", ylab="", col="red",
ylim=c(0,sprintDynamics$pmax.fitted), yaxs= "i", xaxs = "i")
- print(paste("Power =",sprintDynamics$power.fitted))
abline(v = sprintDynamics$tpmax.fitted, col="red")
axis(4, col="red")
mtext(4, text="Power(W/Kg)", col="red")
diff --git a/r-scripts/sprintUtil.R b/r-scripts/sprintUtil.R
index 29c9d04..531b2ce 100644
--- a/r-scripts/sprintUtil.R
+++ b/r-scripts/sprintUtil.R
@@ -46,12 +46,12 @@ getDynamicsFromSprint <- function(K, Vmax, Mass, Temperature = 25, Height , Vw =
# Getting values from the exponential model. Used for numerical calculations
time = seq(0,maxTime, by = 0.01)
v.fitted=Vmax*(1-exp(-K*time))
- a.fitted = Vmax*K*(1 - v.fitted/Vmax)
- f.fitted = Vmax*Mass*K*(1 - v.fitted/Vmax) + Ka*(v.fitted - Vw)^2
- power.fitted = f.fitted * v.fitted
- pmax.fitted = max(power.fitted) #TODO: Make an interpolation between the two closest
points
+ a.fitted = Vmax*K*exp(-K*time)
+ f.fitted = Mass*a.fitted + Ka*(v.fitted - Vw)^2
+ p.fitted = f.fitted * v.fitted
+ pmax.fitted = max(p.fitted) #TODO: Make an interpolation between the two closest
points
pmax.rel.fitted = pmax.fitted / Mass
- tpmax.fitted = time[which.max(power.fitted)]
+ tpmax.fitted = time[which.max(p.fitted)]
#Modeling F-v with the wind friction.
# a(v) = Vmax*K*(1 - v/Vmax)
@@ -71,7 +71,7 @@ getDynamicsFromSprint <- function(K, Vmax, Mass, Temperature = 25, Height , Vw =
return(list(Mass = Mass, Height = Height, Temperature = Temperature, Vw = Vw, Ka = Ka, K.fitted = K,
Vmax.fitted = Vmax,
amax.fitted = amax.fitted, fmax.fitted = fmax.fitted, fmax.rel.fitted = fmax.rel.fitted,
sfv.fitted = sfv.fitted, sfv.rel.fitted = sfv.rel.fitted,
pmax.fitted = pmax.fitted, pmax.rel.fitted = pmax.rel.fitted, tpmax.fitted =
tpmax.fitted, F0 = F0, F0.rel = F0.rel, V0 = V0,
- sfv.lm = sfv.lm, sfv.rel.lm = sfv.rel.lm, pmax.lm = pmax.lm, pmax.rel.lm = pmax.rel.lm,
v.fitted = v.fitted, a.fitted = a.fitted, f.fitted = f.fitted, p.fitted = power.fitted ))
+ sfv.lm = sfv.lm, sfv.rel.lm = sfv.rel.lm, pmax.lm = pmax.lm, pmax.rel.lm = pmax.rel.lm,
v.fitted = v.fitted, a.fitted = a.fitted, f.fitted = f.fitted, p.fitted = p.fitted ))
}
#Finds the time correspondig to a given position in the formula x(t) = Vmax*(t + (1/K)*exp(-K*t)) -Vmax - 1/K
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]