6

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}$" 
4

1 に答える 1

16

変数が gnuplot によって値を割り当てられていないためi、gnuplot はそれを理解できません。gnuplot は、形式を使用して複素数を理解し、操作できます。sqrt(-1)i

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))
于 2013-04-06T19:06:02.567 に答える