How to plot pulse width/value data in python using matlab
조회 수: 8 (최근 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!