vendredi 11 octobre 2019

How can i plot graph of random array having with 20 minutes time and 8 ms interval?

I have a problem with ploting graph in python. I need to create a random array and time array. Then i will plot a graph with them. Time array should start with 0 and it should finish with 20 minutes. The interval of time array should be 8 milliseconds.

I tried to write a code like this: (But the graphic doesnt seems good. Could anyone help me please?)

'''

import numpy as np

import matplotlib.pyplot as plt

random_array= np.random.rand(150000)
time_array= np.linspace(0,1200,150000)

"(The number 1200 is the conversion of 20 minutes to seconds.

" And the number 150000 is for interval. (1200 second / 0.008 second ))

plt.plot(time_array,random_array)

plt.xlabel('Time (second)')

plt.ylabel('Value')

'''




Aucun commentaire:

Enregistrer un commentaire