Reputation: 3737
I have the following gnuplot script which does not yield an output
set encoding utf8
set termoption enhanced
y(x) = 20 * log10(1/((1/694) * x))
set log x
set xrange [1:10]
set xlabel "{/Symbol w} 1/s"
set yrange [-150:150]
set ylabel "G^* dB"
plot y(x)
However, if I replace the y(x)
function with something simpler, eg. y(x) = 20 * log10(1 / x)
the script works as expected.
What is wrong with the function and why gnuplot
is not able to plot it?
Upvotes: 0
Views: 157
Reputation: 4095
In integer arithmetic (1/694) is equal to zero, so the argument of the logarithm is 1/(0*x), which is not numerical. To make sure you are using floating point arithmetic try
y(x) = 20 * log10(1./((1./694.) * x))
Upvotes: 4