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!