How to plot pulse width/value data in python using matlab
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call Python from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!