Hello guys, i´m trying to solve the Poisson´s equation by using the relaxation method to know the potential and electric field matrixs but i have an error that say “index 101 is out of bounds for axis 0 with size 101” and i dont understand what is the problem. ¿Can anyone helpme please?

import numpy as np

import math

# SYMBOLS USED IN THIS CODE

# E = Total electric field matrix using Poisson’s equation

#% V = Potential matrix

#% Nx = Number of grid points in X- direction

#% Ny =Number of grid points in Y-Direction

#Enter the dimensions

Nx = 101 # Number of X-grids

Ny = 101 # Number of Y-grids

mpx = math.ceil(Nx/2) # Mid-point of x

mpy = math.ceil(Ny/2) #Mid point of y

Ni = 750 #Number of iterations for the Poisson solver

V = np.zeros((Nx,Ny))

T = 0 # Top-wall potential

B = 0 # Bottom-wall potential

L = 0 # Left-wall potential

R = 0 # Right-wall potential

#-------------------------------------------------------------------------

# Initializing edges potentials

#-------------------------------------------------------------------------

V[1,:] = L

R= V[Nx,:]

V[:,1] = B

V[:,Ny] = T

#-------------------------------------------------------------------------

# Initializing Corner potentials

#-------------------------------------------------------------------------

V[1,1] = 0.5*(V[1,2]+V[2,1])

V[Nx,1] = 0.5*(V[Nx-1,1]+V[Nx,2])

V[1,Ny] = 0.5*(V[1,Ny-1]+V[2,Ny])

V[Nx,Ny] = 0.5*(V[Nx,Ny-1]+V[Nx-1,Ny])

length_plate = 51 # Length of plate in terms of number of grids

lp = math.floor(length_plate/2)

position_plate = 15 # Position of plate on x axis

pp1 = mpx+position_plate

pp2 = mpx-position_plate

for z in range(1,Ni): #Number of iterations

for i in range(2,Nx-1):

for j in range(2,Ny-1):

#The next two lines are meant to force the matrix to hold the

# potential values for all iterations

V[pp1,mpy-lp:mpy+lp] = 100

V[pp2,mpy-lp:mpy+lp] = -100

V[i,j]=0.25*(V[i+1,j]+V[i-1,j]+V[i,j+1]+V[i,j-1])

# Take transpose for proper x-y orientation

V = np.transpose(V)

[Ex,Ey]=np.gradient(V)

Ex = -Ex

Ey = -Ey

# Electric field Magnitude

E= math.sqrt( Ex*Ex + Ey*Ey )