I am trying to solve a problem that involves complex number. The original expression is extremely long but after debugging for several hours, I have identified the source of my error. When I do an arc tangent of the expression, with different values for the variable which are extremely close, the value jumps by order of magnitude.
The expression is: atan(var_z* (0.058659782 - 0.35747651i))*(161669.61 - 26529.028i)
When I use var_z = -20+3.282i, the value I get is 257585.794 - 19514.30i . When I use the value of var_z = -20+3.281i , the value I get is -250313.14 + 63829.09i .
What could be causing this? The expression is not supposed to have any step function. This is causing a big jump/discontinuity in my answer.
I feel like matlab is somehow messing up the atan function. Any help would be very much appreciated.