Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
您好,我需要在 gnuplot 中绘制一个函数:
h(x) = ((sin(x/2))**2)/((sin(n*x/2))**2)
我不知道如何设置
n = ...-2,-1,0,1,2...
或者也许
n = 1,2,3,4...
我该怎么做?任何帮助将不胜感激。
gnuplot 中的函数定义可以采用多个参数:
h(x,n) = ((sin(x/2))**2)/((sin(n*x/2))**2)
如果要绘制此类函数的范围,可以使用以下for结构:
for
plot for [i=-2:2] h(x,i)
或do for:
do for
do for [i=-2:2] { plot h(x,i) print i # or do other stuff }