The graph you show, that’s not actually the output of your program, is
it? I cannot see how it possibly could be the output. You tell us that
the while loop is an infinite loop, so the program cannot possibly draw
anything at all. Where did the graph come from?
You have this loop:
for degree in range (0, 361,1):
Because 360 degrees is mathematically equal to 0 degrees, you actually
plot the equivalent of 0 degrees twice, only separated by 360 points. Is
You can simplify the loop to:
for degree in range(360): # or 361 if you prefer
You then convert the angle in degrees to radians by hand:
theta = degree * (np.pi/180)
You can do that more neatly using:
# put this line at the top of the program
# and this one inside the loop
theta = math.radians(degree)
You test for a condition:
if sig_1 >= S_Y or sig_3 <= -S_Y:
I’m not sure what that is intended to do, but it clearly is never true,
fail variable never gets set to 0 and the while loop runs
Since that condition is never true, none of the code in the block under
it is never run.
# This block of code never runs.
fail = 0
sig_a = x(i)
sig_b = y(i)
Since fail never gets set to 0, the while loop never ends, and you have
an infinite loop.
That also means that i never gets incremented: it is initialised to
zero, and it stays zero, forever. But that probably doesn’t matter,
because you don’t actually use i anywhere.
And then you have the two lines
sig_a = x(i) and
sig_b = y(i), which
never get run, which is good, because they would fail with a TypeError.
The problm is that x and y are initialised to integers 0, and they never
get changed from 0. Integer 0 is not a function, you cannot call it. If
you do, you get this error:
>>> x = 0
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'int' object is not callable
It is impossible to say what those two lines of code are supposed to be,
without knowing what the code is supposed to do.
So because the
if condition is never true, the TypeError never
happens, and the loop runs forever.
Last but not least, because the loop never ends, the last two lines:
h += 1
Where did you get this code from? If you can point us to the original
source, maybe we can work out how it is supposed to work, because at the
moment I’m afraid it is too full of errors for me to fix them. Sorry.