Gnuplot与复指数

Gnuplot与复指数,gnuplot,Gnuplot,谁能告诉我如何使用gnuplot绘制复指数。我试图使用此脚本绘制它们,但无法识别参数I set terminal epslatex color colortext size 9cm,5cm set size 1.5,1.0 set output "eulerjeva_identiteta_1.tex" set style line 1 linetype 1 linewidth 3 linecolor rgb "#FF0055" set style line 2 linetype 2 linew

谁能告诉我如何使用gnuplot绘制复指数。我试图使用此脚本绘制它们,但无法识别参数
I

set terminal epslatex color colortext size 9cm,5cm
set size 1.5,1.0
set output "eulerjeva_identiteta_1.tex"

set style line 1 linetype 1 linewidth 3 linecolor rgb "#FF0055"
set style line 2 linetype 2 linewidth 1 linecolor rgb "#FF0055"
set style line 3 linetype 1 linewidth 3 linecolor rgb "#2C397D"
set style line 4 linetype 2 linewidth 1 linecolor rgb "#2C397D"
set style line 5 linetype 1 linewidth 3 linecolor rgb "#793715"
set style line 6 linetype 2 linewidth 1 linecolor rgb "#793715"
set style line 7 linetype 1 linewidth 3 linecolor rgb "#b1b1b1"
set style line 8 linetype 3 linewidth 1 linecolor rgb "#b1b1b1"

set grid

set samples 7000

set key at graph .95, 0.4
set key samplen 2
set key spacing 0.8

f(x) = exp(i*x)
g(x) = exp(-i*x)
h(x) = exp(i*x)+exp(-i*x)

set xrange [-2*pi:2*pi]
set yrange [-1.2:1.2]

set xtics ("$0$" 0, "$\\pi$" pi, "$-\\pi$" -pi)
set ytics ("$1$" 1, "$-1$" -1)

set xlabel "$x$"

plot [-2*pi:2*pi] f(x) ls 1 title "$\\e^{ix}$", g(x) ls 3 title "$\\e^{-ix}$", h(x) ls 5 title "$\\e^{ix} + \\e^{-ix}$" 

Gnuplot不把
i
理解为
sqrt(-1)
,因为变量
i
没有被Gnuplot赋值——就它而言,它只是另一个变量名。Gnuplot可以使用该格式理解和操作复数

z = {a,b}
以书面表示法表示复数
z=(a+ib)
。所以,我可以被定义

i = {0.0,1.0}
仍然存在这样一个问题,即当你绘制图形时,你会得到什么

plot exp(i*x)
所有的点都是“未定义的”,因为它们有一个假想的分量。(尽管,
h(x)=exp(i*x)+exp(-i*x)
可以很好地绘制,因为它是纯真实的。)问题是gnuplot只能绘制真实的数量。你可以试试

plot real(exp(i*x)), imag(exp(i*x))
要单独显示零部件,或者可以制作参数化绘图,请执行以下操作:

set parametric
plot real(exp(i*t)), imag(exp(i*t))

我想那应该是
plot imag(exp(I*x))
,因为exp(ix)=cos(x)+isin(x)。注意
exp(ix)=cos(x)+I sin(x)