I am working on ODE circuit suddenly face this problem . How to solve it ?
Most probably, if your N/2 is not an integer, you get such an error.
I would change to w[0:int(N/2)+1] = 2....
w[0:int(N/2)+1] = 2
This is also available for every place you divide N/2.
N/2