Realised that I was writing the array wrong, wrote it again the correct way and testing to see if the NAN error will go away.