How to plot pulse width/value data in python using matlab
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to plot some pulse width (microsecond duration) and pulse value (0/1). The issue seems to be with the x axis which I did not specify as no idea how to do that. Here is the code. The attachment shows the current plot. Any help would be appreciated. Thanks!
import matplotlib.pyplot as plot
import csv
durations = []
values = []
with open("/home/pi/dsc/pulseFile.csv", "r") as csvfile:
for row in csv.reader(csvfile, quoting=csv.QUOTE_NONE):
durations.append(row[0])
values.append(row[1])
dur = durations[0:200]
val = values[0:200]
print('**Display sample of data to plot**')
for x in range(10):
print(dur[x])
print(val[x])
print('**Plotting results**')
plot.title('My Data')
plot.xlabel('Time')
plot.ylabel('Amplitude')
plot.plot(dur, val)
plot.show()
0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Call Python from MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!