Does anyone can help me with problems on to fill the elements of my matrix?

Viewed 22

I am with a problem in my Python Code. I am trying to fill a Matrix "A_control" with dimensions "2NGL x 2NGL", being NGL=2. But something is wrong and when I try to run my code the following mensage appears: "index 7 is out of bounds for axis 0 with size 6".

Does anyone know how can I fix it?

The part of my code follows:

p=3; q=2;
        for p in range (p, (2*NGL-1)):
            A_control[p,0]=kt[i,j]/mt;
            A_control[p,1]=ct[i,j]/mt;
            for q in range (q, (2*NGL-1)):
                A_control[p,q]=-kt[i,j]/mt
                print(p,q)
                A_control[p,q+1]=-ct[i,j]/mt
                q=q+1
                p=p+2
            print(p,q)

Thanks

0 Answers
Related