Divide by zero warning: Actual division by zero or spurious?

I have the following code that calculates the gain of an amplifier

Clear["Global*"]

ϕ0 = 2.07;
fp = 5.97;
ωp = 2 π*fp;
ωs = 2 π*fs;
ωi = (2*ωp - ωs);
a = 10;
LL = 100*10^-3;
Ij = ϕ0/(2 π*LL);
Ip = 0.5*Ij;
zchar = 50;
CC = 39*10^-6;
Cj = 329*10^-6;

NN = 1900;
x = NN*a;

zcloss = 1/(I*ω*CC*(1 - I/(ω*RR*CC)));

CC0p = 1/(I*ωp*(zcloss /. {ω -> ωp}));
CC0s = 1/(I*ωs*(zcloss /. {ω -> ωs}));
CC0i = 1/(I*ωi*(zcloss /. {ω -> ωi}));

kp = (ωp Sqrt[LL*CC0p])/(a Sqrt[1 - LL*Cj*ωp^2]);
ks = (ωs Sqrt[LL*CC0s])/(a Sqrt[1 - LL*Cj*ωs^2]);
ki = (ωi Sqrt[LL*CC0i])/(a Sqrt[1 - LL*Cj*ωi^2]);

Ap0 = (Ip*zchar)/ωp;
κ = (a^2*kp^2*Abs[Ap0]^2)/(16*Ij^2*LL^2);

αp = (κ*kp^3*a^2)/(LL*CC0p*ωp^2);
αs = (2 κ*ks^3*a^2)/(LL*CC0s*ωs^2);
αi = (2 κ*ki^3*a^2)/(LL*CC0i*ωi^2);

κs = (κ*(2 kp - ki) ks*ki*a^2)/(LL*CC0s*ωs^2);
κi = (κ*(2 kp - ks) ks*ki*a^2)/(LL*CC0i*ωi^2);

ΔkL = 2 kp - ks - ki;
ΔkNL = 2 αp - αs - αi;
Δk = ΔkL + ΔkNL;

g = Sqrt[κs*Conjugate[κi] - (Δk/2)^2];

RHRPMgain = Abs[Cosh[g*x] - (I*Δk)/(2*g)*Sinh[g*x]]^2;

Plot[Evaluate@Table[Chop[RHRPMgain], {RR, {6.84*10^6, 6.84*10^5, 6.84*10^4, 2*6.84*10^3}}], {fs, 1/100, 12}, AxesOrigin -> {0, 0}, PlotRange -> {All, {0, 10}}, ImageSize -> Large, PlotStyle -> {Directive[Red], Directive[Black, Dashed], Directive[Blue, DotDashed], Directive[Darker@Green, Dashing[Large]]}]

Plot[Evaluate@Table[10*Log10[Chop[RHRPMgain]], {RR, {6.84*10^6, 6.84*10^5, 6.84*10^4, 2*6.84*10^3}}], {fs, 1/100, 12}, AxesOrigin -> {0, 0}, PlotRange -> {All, {-10, 10}}, ImageSize -> Large, PlotStyle -> {Directive[Red], Directive[Black, Dashed], Directive[Blue, DotDashed], Directive[Darker@Green, Dashing[Large]]}]


Upon executing, I'm getting warnings about division-by-zero. Initially I thought it has to do with my plotting range, which I had set to (fs, 0.01, 12) instead of (fs, 0, 12). But the warning seems to persist. Furthermore, I am seeing values that are blown up at the tail ends of the plot, giving large negative values (especially the green-dashed curve). I am attributing that to divide-by-zero errors, however, I don't know where it is coming from. What is going on here?

• Rats, I get no errors. But I recently was teaching someone Mathematica, and they found the stack-trace feature when you click the three-dot button on the error message extremely helpful. But I get no errors, so I can't check to see how useful it might be. Commented May 3, 2022 at 23:23

I am attributing that to divide-by-zero errors, however, I don't know where it is coming from.

For some values of your fs , your data gives 1/0 and or Infinity::indet: Indeterminate expression

Generate the data

data = Table[Chop[RHRPMgain], {RR, {6.84*10^6, 6.84*10^5, 6.84*10^4, 2*6.84*10^3}}]


Try it at sampling value of

data /. fs -> 597/50


gives

Power::infy: Infinite expression 1/0. encountered.


The Plot command hit on such value, so it gives 1/0`