Plot timing time high / time low data period read from 433Mhz trace.

huangapple go评论74阅读模式
英文:

Plot timing time high / time low data period read from 433Mhz trace

问题

我正在使用Arduino从一个433MHz收发器读取高/低定时数据。

数据的格式如下:总计数,然后是毫秒高和毫秒低。在这个示例中,有125个读数,从83毫秒高开始,然后低84毫秒,依此类推。

如何读取这些数据并使用Gnuplot绘制类似附图的波形,以便我可以研究波形?

Plot timing time high / time low data period read from 433Mhz trace.

我习惯于绘制x/y或时间序列图表,使用不同的数据列。但我不确定从这种数据开始应该做什么。

英文:

I am reading high / low timing data from an 433Mhz transceiver using Arduino.

The data is in the following formation Total count, followed by ms high and then ms low. In this example-125 readings, starting high for 83ms and then low for 84ms and so on.

125:83,84,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,84,83,83,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,82,84,83,84,83,84,83,84,83,84,84,84,83,84,83,84,83,84,83,84,83,86,497,84,90,84,93,84,95,84,181,99,83,102,83,104,83,179,91,84,177,178,181,99,83,184,103,84,96,84,175,176,179,97,83,182,185,186,180,174,177,95,83,98,83,100,83,184,187,96,83,92,83,94,83,96,83,98,83,100,83,184,187,89 

How can I read this data and plot using Gnuplot like the attached image, so I can study the wave form?

Plot timing time high / time low data period read from 433Mhz trace.

I am used to plotting x/y or time series graphs with separate data columns. But I am not sure where to start with this type of data.

答案1

得分: 1

以下是您要翻译的内容:

Data:

SO75553813_col.dat

125:
83
84
84
83
84
83
84
83
84
83
84
83
84
83
84
83
84
84
83
83
84
83
84
83
84
83
84
83
84
83
84
83
84
83
84
83
84
83
84
83
84
83
84
83
84
82
84
83
84
83
84
83
84
83
84
84
84
83
84
83
84
83
84
83
84
83
86
497
84
90
84
93
84
95
84
181
99
83
102
83
104
83
179
91
84
177
178
181
99
83
184
103
84
96
84
175
176
179
97
83
182
185
186
180
174
177
95
83
98
83
100
83
184
187
96
83
92
83
94
83
96
83
98
83
100
83
184
187
89

SO75553813_row.dat

125:83,84,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,84,83,83,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,82,84,83,84,83,84,83,84,83,84,84,84,83,84,83,84,83,84,83,84,83,86,497,84,90,84,93,84,95,84,181,99,83,102,83,104,83,179,91,84,177,178,181,99,83,184,103,84,96,84,175,176,179,97,83,182,185,186,180,174,177,95,83,98,83,100,83,184,187,96,83,92,83,94,83,96,83,98,83,100,83,184,187,89

Script:

### 绘制高低信号
reset session

FILE_COL = "SO75553813_col.dat";
FILE_ROW = "SO75553813_row.dat";

set offsets graph 0.05, graph 0.05, graph 0.1, graph 0.1
set xrange[:] noextend
set key noautotitle

set multiplot layout 2,1

    set title "列数据";
    plot x1=0 FILE_COL  u (x0=x1, x1=x1+$1, x0):(y0=int($0+1)%2) skip 1 w steps lc "red", \
             '+' u (x0):(y0):(x1-x0):(0) every ::::0 w vec nohead lc "red" 
             
    set title "行数据";
    set datafile separator ":,"
    plot x1=0 FILE_ROW matrix u (x0=x1, x1=x1+$3, x0):(y0=int($1)%2) every ::1 w steps lc "blue", \
             '+' u (x0):(y0):(x1-x0):(0) every ::::0 w vec nohead lc "blue" 
unset multiplot
### 脚本结束

Result:

Plot timing time high / time low data period read from 433Mhz trace.

英文:

There is the plotting style with steps in different variations.
However, in order to get to data points you first have to sum up your durations, but then the last horizontal line will be missing.

You could use the plotting style with vectors or xerrorbars then you could easily plot durations, but then the vertical lines would be missing.

So, I guess you either have to

  • plot the data twice for horizontal lines and vertical lines using with vectors
  • or plot the data with steps and only add the last horizontal line with vectors.

The following example is using the latter approach.
If it is not critical, you might want to skip the last horizontal line to simplify the plot command.

Depending on your input data the plot command will be different. First graph with column data, second graph data with row data. gnuplot prefers data in columns, but for data in rows you can use the option matrix (actually, a 1 x 125 matrix)

  • you sum up your durations in the variable x1. x0 is the previous value.
  • since you have alternating high/low data, you get the y-values using modulo operator %.

Data:

SO75553813_col.dat

125:
83
84
84
83
84
83
84
83
84
83
84
83
84
83
84
83
84
84
83
83
84
83
84
83
84
83
84
83
84
83
84
83
84
83
84
83
84
83
84
83
84
82
84
83
84
83
84
83
84
83
84
84
84
83
84
83
84
83
84
83
84
83
86
497
84
90
84
93
84
95
84
181
99
83
102
83
104
83
179
91
84
177
178
181
99
83
184
103
84
96
84
175
176
179
97
83
182
185
186
180
174
177
95
83
98
83
100
83
184
187
96
83
92
83
94
83
96
83
98
83
100
83
184
187
89

SO75553813_row.dat

125:83,84,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,84,83,83,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,83,84,82,84,83,84,83,84,83,84,83,84,84,84,83,84,83,84,83,84,83,84,83,86,497,84,90,84,93,84,95,84,181,99,83,102,83,104,83,179,91,84,177,178,181,99,83,184,103,84,96,84,175,176,179,97,83,182,185,186,180,174,177,95,83,98,83,100,83,184,187,96,83,92,83,94,83,96,83,98,83,100,83,184,187,89

Script:

### plottting high low signals
reset session

FILE_COL = "SO75553813_col.dat"
FILE_ROW = "SO75553813_row.dat"

set offsets graph 0.05, graph 0.05, graph 0.1, graph 0.1
set xrange[:] noextend
set key noautotitle

set multiplot layout 2,1

    set title "column data"
    plot x1=0 FILE_COL  u (x0=x1, x1=x1+$1, x0):(y0=int($0+1)%2) skip 1 w steps lc "red", \
             '+' u (x0):(y0):(x1-x0):(0) every ::::0 w vec nohead lc "red" 
             
    set title "row data"
    set datafile separator ":,"
    plot x1=0 FILE_ROW matrix u (x0=x1, x1=x1+$3, x0):(y0=int($1)%2) every ::1 w steps lc "blue", \
             '+' u (x0):(y0):(x1-x0):(0) every ::::0 w vec nohead lc "blue" 
unset multiplot
### end of script

Result:

Plot timing time high / time low data period read from 433Mhz trace.

huangapple
  • 本文由 发表于 2023年2月24日 15:45:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/75553813.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定