Adding a threshold in numerical codes

  • Context: Undergrad 
  • Thread starter Thread starter matteo86bo
  • Start date Start date
  • Tags Tags
    Numerical Threshold
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
2 replies · 2K views
matteo86bo
Messages
56
Reaction score
0
Hi,
I noticed such a strange behavior in my code every time I add a threshold: little oscillation around the threshold value itself.

For example
[tex]f(x) = g(x), x > x_c[/tex]
[tex]f(x) = 0, x <= x_c[/tex]
[tex]\frac{dx}{dt}=f(x)[/tex]

I solve the last equation and I find this oscillation. Can they be removed?
 
Physics news on Phys.org
Yes, I definitely believe it's a numerical problem. I have no improvement if I solve the equation in a thicker grid.