是否可以使用 TeX 构建谱线?

是否可以使用 TeX 构建谱线?

我想演示光谱线图中的变化。我想知道 TeX 是否能够生成光谱线图。我知道它在能级图方面的功能非常有用。提前致谢。

答案1

虽然,你已经解决了你的问题。这是一个使用 pgfplots 的相对简单的解决方案:

\documentclass{article}

\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\begin{document}
    \begin{tikzpicture}
        \begin{axis}[width=8cm, height=5cm,
            xlabel=$\lambda$ (nm), ylabel=Intensity (a. u.), 
            ytick = \empty,
            xmin = 300, xmax=700, ymin = 0
        ]
        \addplot[ycomb, variable=\t, samples at={3,4,...,11}]
            (({364.6*t^2/(t^2-4)}, {1/t});
        \end{axis}
    \end{tikzpicture}
\end{document}

这里计算的值和强度计算只是一个野客,但你当然也可以绘制数据点。

在此处输入图片描述

答案2

技巧只是为了好玩!

在此处输入图片描述

\documentclass[pstricks,border=12pt]{standalone}

%[email protected]
%Juin 2 000
\makeatletter
\def\psYoungR{\pst@object{psYoungR}}
\def\psYoungR@i{\@ifnextchar({\psYoungR@do}{\psYoungR@do(0,0)}}
\def\psYoungR@do(#1)#2#3#4#5{%
  \begin@ClosedObj
  \pst@@getcoor{#1}%
  \addto@pscode{%
    \pst@coor
    translate
    /bornexpt  400 def
    bornexpt neg 1 bornexpt{
      /abscissept exch def
    % x en m
      /abscisse abscissept 2845 div def
      /DistanceEcran #3 def
      /EcartFentes #2 def
      /largeurFentes #4 def
      /lambdaR #5 def
      /argumentDeg abscisse 180 mul largeurFentes mul DistanceEcran div def
      /argumentRad argumentDeg 180 div Pi mul def
      /sinCR argumentRad 0 eq {1} {argumentDeg lambdaR div sin argumentRad div lambdaR mul} ifelse def
      180 EcartFentes mul abscisse mul lambdaR div DistanceEcran div cos dup mul
      sinCR dup  mul mul
      0
      0
      setrgbcolor 2 setlinewidth
      abscissept -40  moveto abscissept 40 lineto stroke}
    for }%
  \end@ClosedObj\ignorespaces%
}
\def\psYoungRVB{\pst@object{psYoungRVB}}
\def\psYoungRVB@i{\@ifnextchar({\psYoungRVB@do}{\psYoungRVB@do(0,0)}}
\def\psYoungRVB@do(#1)#2#3#4{
\begin@ClosedObj
\pst@@getcoor{#1}%
\addto@pscode{%
\pst@coor
 translate
 /bornexpt  400 def
 bornexpt neg 1 bornexpt{
 /abscissept exch def
 % x en m
 /abscisse abscissept 2845 div def
 /lambdaB 436e-9 def
 /lambdaV 546e-9 def
 /lambdaR 700e-9 def
 /DistanceEcran #3 def
 /EcartFentes #2 def
 /largeurFentes #4 def
 /argumentDeg abscisse 180 mul largeurFentes mul DistanceEcran div def
 /argumentRad argumentDeg 180 div Pi mul def
 /sinCR argumentRad 0 eq {1} {argumentDeg lambdaR div sin argumentRad div lambdaR mul}
  ifelse def
 /sinCV argumentRad 0 eq {1} {argumentDeg lambdaV div sin argumentRad div lambdaV mul}
  ifelse def
 /sinCB argumentRad 0 eq {1} {argumentDeg lambdaB div sin argumentRad div lambdaB mul}
  ifelse def
 180 EcartFentes mul abscisse mul lambdaR div DistanceEcran div cos dup mul
 sinCR dup  mul mul
 180 EcartFentes mul abscisse mul lambdaV div DistanceEcran div cos dup mul
 sinCV dup  mul mul
 180 EcartFentes mul abscisse mul lambdaB div DistanceEcran div cos dup mul
 sinCB dup  mul mul
 setrgbcolor 2 setlinewidth
  abscissept -40  moveto abscissept 40 lineto stroke}
 for}
\end@ClosedObj
}
\pagestyle{empty}
\makeatother
\begin{document}

\begin{pspicture*}(-8.5,-1.5)(8.5,1.5)
\psYoungRVB(0,0){50e-6}{2}{10e-6}
\end{pspicture*}
\end{document}

相关内容