0
点赞
收藏
分享

微信扫一扫

使用 gnuplot 绘制离散序列以及 DFT 结果


绘制离散序列

将离散序列保存到文件 1.dat:

0 0.3535
1 0.3535
2 0.6464
3 1.0607
4 0.3535
5 -1.0607
6 -1.3535
7 -0.3535

每行两个数,前一列为序列编号,后一列为对应的序列值,空格分隔。

gnuplot 绘制文件 1.dat 的序列:

set key off
set xlabel 'n'
set ylabel 'x(n)'
set grid
set size ratio 0.5
plot [-0.5:7.5] [-2:2] '1.dat' with points pointtype 5

或者直接命令调用:

gnuplot -p -e "set key off; set xlabel 'n'; set ylabel 'x(n)'; set grid; set size ratio 0.5; plot [-0.5:7.5] [-2:2] '1.dat' with points pointtype 5"

绘图结果:

使用 gnuplot 绘制离散序列以及 DFT 结果_存到文件

绘制 DFT 结果

将 DFT 结果保存到文件 2.dat:

0 0.0
1 4.0
2 2.0
3 0.0
4 0.0
5 0.0
6 2.0
7 4.0

每行两个数,前一列为序列编号,后一列为对应的DFT结果,空格分隔。

gnuplot 绘制文件 2.dat 的序列:

set key off
set xlabel "m (kHz)"
set ylabel "X(m)"
set size rate 0.5
plot [0:7.1] [0:6] '2.dat' with impulses lw 3, '2.dat' pt 5

或者直接命令调用:

gnuplot -p -e "set key off; set xlabel 'm(kHz)'; set ylabel 'X(m)'; set grid;set size ratio 0.5; plot [-0.5:7.5] [0:5] '2.dat' with impulses lw 3, '2.dat' pt 5"

绘图结果:

使用 gnuplot 绘制离散序列以及 DFT 结果_参考资料_02

参考资料

  • ​​Official gnuplot documentation​​
  • ​​gnuplot下载及基本使用​​
  • ​​gnuplot 入门教程​​
  • ​​如何在gnuplot中设置网格间距​​
  • ​​谈谈gnuplot(二十):图像尺寸​​


举报

相关推荐

0 条评论