Skip to content

Commit

Permalink
Fixed error in the find_optimal_FV_scalar() function and all upper-…
Browse files Browse the repository at this point in the history
…level calling functions which happens when `resistance` parameter is below zero
  • Loading branch information
mladenjovanovic committed May 2, 2024
1 parent edbc667 commit 1105c38
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Updated the *in-situ* examples in the README file
* Cleaned the `theme_bw()` from README and set default `ggplot` theme with `ggdist::ggdist()`
* Fixed the error in README example for plotting the in-situ velocity-acceleration profile
* Fixed error in the `find_optimal_FV_scalar()` function and all upper-level calling functions which happens when `resistance` parameter is below zero

# shorts 3.1.0

Expand Down
4 changes: 2 additions & 2 deletions R/optimal-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ find_optimal_FV_scalar <- function(distance, F0, V0, bodymass = 75, inertia = 0,
par = 1,
fn = opt_func,
method = "Brent",
lower = 1 / min(100, F0 / resistance),
upper = min(100, F0 / resistance)
lower = 1 / min(100, F0 / ifelse(resistance < 0, 0, resistance)),
upper = min(100, F0 / ifelse(resistance < 0, 0, resistance))
)
},
error = function(cond) {
Expand Down

0 comments on commit 1105c38

Please sign in to comment.