0

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?

1 Answer 1

4

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))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.