1. Are you sure this generates something meaningful for negative r? Those bessel functions return complex results for negative r.
help besselk
besselk Modified Bessel function of the second kind.
K = besselk(NU,Z) is the modified Bessel function of the second kind,
K_nu(Z). The order NU need not be an integer, but must be real.
The argument Z can be complex. The result is real where Z is positive.
If I had to guess, the function is symmetric across zero, since when r is negative, I see a comment in your code about abs( r ), but then you never bother to use abs() in the code.
2. The limit of K1/K0 as r --> 0 from above appears to be +inf. If you try to evaluate those functions exactly at r==0, you have a 0/0 condition, which will be NaN.