Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. Eq = x'[t] + (x[t] - λ) == 0;
  2.  
  3. WhenEvent[x'[t] == 0, λ -> x[t]].
  4.  
  5. λ = 1;
  6. Eq = x'[t] + (x[t] - λ) == 0;
  7. sol = NDSolve[{Eq, x[0] == 0,
  8. WhenEvent[x'[t] == 0., λ -> x[t]]
  9. }, x, {t, 0, 5}][[1]]
  10.  
  11. equation = x'[t] + (x[t] - λ[t]) == 0;
  12. sol = NDSolveValue[{equation, x[0] == 0, λ[0] == 1,
  13. WhenEvent[x'[t] == 0.25, λ[t] -> x[t]]}, x, {t, 0, 5},
  14. DiscreteVariables -> {λ}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement