How to plot pulse width/value data in python using matlab

8 Ansichten (letzte 30 Tage)
Tim
Tim am 14 Jan. 2020
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()

Antworten (0)

Kategorien

Mehr zu Call Python from MATLAB finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by