خرید بک لینک

Vote count: 0

I am trying to create a matrix with that is 8 by 3. For each row I want the three values to be the results of the trigonometric functions described in my code below.

The problem is that I keep getting an error saying that the list index is out of range. I don't understand why it is saying it is out of range. To my eyes, my loop seems correct. Can anyone tell me what I'm overlooking/doing wrong?

# Input az matrix
    az = [142.243258152,116.039625836,80.1585056414,139.614063776,87.2093336287,94.1433825229,35.5599100744,11.0328982848,177.717968103,19.0072693362]

# Construct frame of X matrix
X = [[0 for x in range(8)] for y in range(3)]

# Use az matrix to complete X matrix
f=0
for bear in az:
    X[f][0] = (M.cos(bear))**2
    X[f][1] = 2*M.cos(bear)*M.sin(bear)
    X[f][2] = (M.sin(bear))**2
    f=f+1

print X

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 12 خرداد 1395 ساعت: 5:54

صفحه بندی