skrat - 3 months ago 25

Python Question

I have to prepare my data for animation and I ran across a problem

`t = numpy.linspace(0, 1/10, 1/10000)`

x = [1, 3, 5, 7, 9]

S = [ 0.09642699 -1.75110819 -0.00915477 -0.42833324 -0.01772692 -0.00885592

-0.01136874 0.4106214 0.09199903 1.73339635]

realResponse = [x * numpy.cos(311.64*t) for x in numpy.dot(eigenvector, modalconstant)]

#realResponse = numpy.delete(realResponse, my_list, axis=0)

Now this

`realResponse`

`print(realResponse)# prints: [array([], dtype=float64),`

array([], dtype=float64), array([], dtype=float64),....

I don't know what seems to be the problem. I carefully followed this topic.

Anyway I also tried

`realResponse = list()`

for i in range(0, 10):

realResponse[i] = S[i] * numpy.cos(eigenvalue[311.64*t)

and turns out to be an error:

IndexError: list assignment index out of range

Answer

`numpy.linspace(0, 1/10., 1/10000.)`

returns an empty array. If you want an array between 1/10 with points every 1/10000 try:

`numpy.arange(0, 1/10., 1/10000.)`