我正在尝试使用gnuplot绘制扬声器在+/- 90度范围内的离轴响应。我很好地工作,几乎完全是Creating a microphone polar pattern plot in gnuplot
的结果我想扩展这一点,以便提出前进" 180范围但我不知道如何做到这一点&我会很感激一些指点。
这是我目前的代码
gnuplot <<EOF
set terminal pngcairo size ${WIDTH}/2,${HEIGHT}/2 font ',10'
set polar
set angle degrees
set size ratio 1
set tmargin 3
set bmargin 3
set style line 11 lc rgb 'gray80' lt -1
set grid polar ls 11
unset border
unset xtics
unset ytics
set xrange [-30:30]
set yrange [-30:30]
set key
r=1
set rrange [0:r]
set rtics 0.166 format '' scale 0
set label '0°' center at first 0, first r*1.05
set label '180°' center at first 0, first -r*1.05
set label '-90°' right at first -r*1.05, 0
set label '+90°' left at first r*1.05, 0
set for [i=1:5] label at first r*0.02, first r*((i/6.0) + 0.03) sprintf("%d dB", -30+(i*5))
unset raxis
set key outside top right
set style line 11 lw 2
set output '${PREFIX}_polar.png'
set multiplot layout 1,2 title "Circular Polar Response"
set title "Normalised"
plot '${PREFIX}_norm_polar_1000.txt' t '1k' w lp ls 11 lt 1 pt -1 , \
'${PREFIX}_norm_polar_2000.txt' t '2k' w lp ls 11 lt 2 pt -1 , \
'${PREFIX}_norm_polar_4000.txt' t '4k' w lp ls 11 lt 3 pt -1 , \
'${PREFIX}_norm_polar_8000.txt' t '8k' w lp ls 11 lt 4 pt -1 , \
'${PREFIX}_norm_polar_16000.txt' t '16k' w lp ls 11 lt 5 pt -1
set title "Unnormalised"
plot '${PREFIX}_polar_1000.txt' t '1k' w lp ls 11 lt 1 pt -1 , \
'${PREFIX}_polar_2000.txt' t '2k' w lp ls 11 lt 2 pt -1 , \
'${PREFIX}_polar_4000.txt' t '4k' w lp ls 11 lt 3 pt -1 , \
'${PREFIX}_polar_8000.txt' t '8k' w lp ls 11 lt 4 pt -1 , \
'${PREFIX}_polar_16000.txt' t '16k' w lp ls 11 lt 5 pt -1
EOF
结果是
数据看起来像这样(这是示例图片中的1k行)
180 0.657067
172.5 0.6832
165 0.717767
157.5 0.7461
150 0.7747
142.5 0.806167
135 0.835633
127.5 0.865167
120 0.890533
112.5 0.918133
105 0.929633
97.5 0.9566
90 0.9632
82.5 0.9566
75 0.929633
67.5 0.918133
60 0.890533
52.5 0.865167
45 0.835633
37.5 0.806167
30 0.7747
22.5 0.7461
15 0.717767
7.5 0.6832
0 0.657067
答案 0 :(得分:6)
然后,您还必须使用set size ratio -1
才能在x和yrange中获得相同的缩放比例。仅绘制上两个象限时,您会得到与set size square
错误的宽高比。
set terminal pngcairo font ',10'
set polar
set angle degrees
set size ratio 1
set lmargin 8
set style line 11 lc rgb 'gray80' lt -1
set grid polar ls 11
unset border
unset tics
set xrange [-1:1]
set yrange [0:1]
set size ratio -1
r = 1
set rtics 0.166 format '' scale 0
set label '0°' center at first 0, first r*1.05
set label '-90°' right at first -r*1.05, 0
set label '+90°' left at first r*1.05, 0
set for [i=1:5] label at first r*0.02, first r*((i/6.0) + 0.03) sprintf("%d dB", -30+(i*5))
unset raxis
set key outside top right
set output 'polar.png'
plot 'norm_polar_1000.txt' w lp ls 1 t '1k'