PSTricks を使用して関数とデータを一緒にプロットする

PSTricks を使用して関数とデータを一緒にプロットする

PSTricks を使用して次のグラフを作成したいと思います。

欲しい

ダウンロードできるデータは、翻訳元は、3 つのグラフと一緒にプロットされるはずです。以前にこれに似たデータと関数をプロットしたことがありますが、何らかの理由でこれをプロットする方法がわかりません。環境の中に環境を配置しようとしましたがpsgraph、y 軸のスケールが間違っています。pspicturefigure

\documentclass{article}
\usepackage{pst-plot}
\begin{document}
\begin{figure}
 \centering
   \psset{
     xAxisLabel = {$t$~(s)},
     yAxisLabel = {$x$~(m)}
   }
   \begin{pspicture}(-0.7,0.06)(5.4,0.14)
   \begin{psgraph}[
     Dy = 0.01,
     Oy = 0.0954
   ]{->}(0,0.0954)(0,0.065)(5.2,0.13){10cm}{7cm}
     \readdata{\daempning}{daempning.txt}
     \dataplot[
       plotstyle = dots,
       dotsize = 4pt,
       dotstyle = o,
       fillstyle = solid,
       fillcolor = blue
     ]{\daempning}
   \end{psgraph}
   \end{pspicture}
  \caption{D{\ae}mpede svingninger af fjeder.}
 \label{fig:daempede-svingninger}
\end{figure}

\end{document}

得た

アップデート

データをプロットすることができました。

\documentclass{article}

\usepackage{
  pst-plot,
  pst-math
}
\psset{
  xunit = 1.95,
  yunit = 0.8,
  algebraic
}

\begin{document}

\begin{figure}
% constants.
\def\bKonst{0.182323628}
\def\mKonst{0.179887}
\def\kKonst{25.04285714}
\def\omegaSHBKonst{12.1277}
\def\omegadKonst{1.026}
\def\AKonst{0.0264572}
\def\pKonst{0.095398}
% functions (something is wrong here)
\def\hFunk(#1){\AKonst*exp(-\bKonst/(2*\mKonst)*#1)}
\def\spring(#1){\hFunk(#1)*ACOS(sqrt(\kKonst/\mKonst-(\bKonst/(2*\mKonst))^2)*#1+ATAN(\bKonst/\mKonst/(\omegaSHBKonst^2-\omegadKonst^2)))+\pKonst}
% data
\readdata{\daempning}{daempning.txt}
% plot
\centering
  \begin{pspicture}(-0.57,5.35)(5.65,16.9)
    \pstScalePoints(1,8){1000 div}{660 sub 600 div}
    \psaxes[
      dx = 1,
      Dx = 1.00,
      xsubticks = 5,
      dy = 1,
      Dy = 0.005,
      Oy = 0.095,
      comma
    ]{->}(0,9.5398)(0,5.5)(5.25,16)[$t$~(s),0][$x$~(m),90]
    \listplot[
      plotstyle = dots,
      dotstyle = o,
      fillcolor = red
    ]{\daempning}
%    \psplot{0}{5}{\spring(x)}
  \end{pspicture}
  \caption{D{\ae}mpede svingninger af fjeder.}
 \label{fig:daempede-svingninger}
\end{figure}

\end{document}

出力半完成

しかし、3 つのグラフはまだ頭を悩ませています。これらをプロットするにはどうすればよいでしょうか?

答え1

そうでありCOS、そうではないのですACOS

\documentclass{article}
\usepackage{pst-plot,pst-math}
\psset{xunit = 1.95,yunit = 100,algebraic}

\begin{document}

\def\bKonst{0.182323628}
\def\mKonst{0.179887}
\def\kKonst{25.04285714}
\def\omegaSHBKonst{12.1277}
\def\omegadKonst{1.026}
\def\AKonst{0.0264572}
\def\pKonst{0.095398}
% functions (something is wrong here)
\def\spring{\AKonst*Euler^(-x*\bKonst/(2*\mKonst))
            *COS(sqrt(\kKonst/\mKonst-(\bKonst/(2*\mKonst)))
            *x+ATAN(\bKonst/\mKonst/(\omegaSHBKonst^2-\omegadKonst^2)))
            +\pKonst
%  0.0264572*Euler^(-0.506773*x)*COS(11.788*x+0.00694063)+0.095398
}

% data
\readdata{\daempning}{/tmp/test.data}
% plot
  \begin{pspicture}(-0.57,0.065)(5.65,0.14)
    \psplot[plotpoints=1000]{0}{5}{\spring}
    \psplot[plotpoints=100,linecolor=red]{0}{5}{0.0264572*Euler^(-0.506773*x)+0.095398}
    \psplot[plotpoints=100,linecolor=red]{0}{5}{-0.0264572*Euler^(-0.506773*x)+0.095398}
    \psaxes[xsubticks = 5,Dy = 0.010,Oy = 0.095,comma]{->}%
       (0,0.095398)(0,0.06)(5.25,0.13)[$t$~(s),0][$x$~(m),90]
    \pstScalePoints(1,1){1000 div}{14000 div 0.006 sub}
    \listplot[plotstyle = dots,dotscale=0.5,linecolor=blue]{\daempning}
  \end{pspicture}

\end{document}

ここに画像の説明を入力してください

関連情報