[chronojump] RaceAnalyzer. Plot pmax.pitted an tpmax.fitted



commit a577ff5efb046e7f855ac094b4572645515ff427
Author: Xavier Padullés <x padulles gmail com>
Date:   Thu Feb 6 17:13:14 2020 +0100

    RaceAnalyzer. Plot pmax.pitted an tpmax.fitted

 r-scripts/sprintEncoder.R | 17 +++++++++++++----
 r-scripts/sprintUtil.R    |  4 ++--
 2 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/r-scripts/sprintEncoder.R b/r-scripts/sprintEncoder.R
index 09cff5f2..9601a431 100644
--- a/r-scripts/sprintEncoder.R
+++ b/r-scripts/sprintEncoder.R
@@ -480,7 +480,7 @@ plotSprintFromEncoder <- function(sprintRawDynamics, sprintFittedDynamics,
                 }
                 if (plotRawPower)
                 {
-                        #Plotting rawForce
+                        #Plotting rawPower
                         par(new = TRUE)
                         
plot(sprintRawDynamics$time[sprintRawDynamics$startSample:sprintRawDynamics$endSample], 
sprintRawDynamics$rawPower[sprintRawDynamics$startSample:sprintRawDynamics$endSample],
                              ylim = ylimits, type = "l", col = "red",
@@ -495,9 +495,18 @@ plotSprintFromEncoder <- function(sprintRawDynamics, sprintFittedDynamics,
                         #Plotting fittedPower
                         par(new = TRUE)
                         plot(sprintFittedDynamics$t.fitted, sprintFittedDynamics$p.fitted
-                             , ylim = ylimits , type = "l", col = "red", lty = 2,
-                             xlab = "", ylab = "",
-                             axes = FALSE, yaxs = "i", xaxs = "i")
+                             , ylim = ylimits , type = "l", col = "red"
+                             ,xlab = "", ylab = ""
+                             ,axes = FALSE, yaxs = "i", xaxs = "i")
+                        text(x = sprintFittedDynamics$tpmax.fitted, y = sprintFittedDynamics$pmax.fitted
+                             , labels = paste(round(sprintFittedDynamics$pmax.fitted, digits = 2), "W")
+                             , pos = 3
+                             , col = "red")
+                        lines(c(sprintFittedDynamics$tpmax.fitted, sprintFittedDynamics$tpmax.fitted), 
c(sprintFittedDynamics$pmax.fitted, 0)
+                              , lty = 2, col = "red")
+                        mtext(paste(round(sprintFittedDynamics$tpmax.fitted, digits = 3), "s")
+                              , at = sprintFittedDynamics$tpmax.fitted, side = 1
+                              , col = "red")
                 }
                 axis(side = 4, col = "red", line = 4)
         }
diff --git a/r-scripts/sprintUtil.R b/r-scripts/sprintUtil.R
index 32c00fba..8f94a610 100644
--- a/r-scripts/sprintUtil.R
+++ b/r-scripts/sprintUtil.R
@@ -64,9 +64,9 @@ getDynamicsFromSprint <- function(K, Vmax, Mass, Temperature = 25, Height , Vw =
         V0 = -F0/fvModel$coefficients[2]             # Similar to Vmax.fitted. V0 is the interception of the 
linear regression with the horizontal axis
         pmax.lm = V0 * F0/4                          # Max Power Using the linear regression. The maximum is 
found in the middle of the parabole p(v)
         pmax.rel.lm = pmax.lm / Mass
-        pmax.fitted = fmax.fitted * Vmax / 4         # Obtained from the function P(v) = F(v) * v. It is a 
parabele. The apex is in Vmax/2
+        pmax.fitted = max(p.fitted)
         pmax.rel.fitted = pmax.fitted / Mass
-        tpmax.fitted = log(2) / K                    # Obtained from P'(t) = 0
+        tpmax.fitted = time[which(p.fitted == pmax.fitted)]
         
         return(list(Mass = Mass,
                     Height = Height, Temperature = Temperature,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]