# Plot functions and data together using PSTricks

I would like to create the following graph using PSTricks:

The data, which can be downloaded from http://gupl.dk/705644/, should be plotted together with the three graphs. I have managed to plot data and functions similar to this before, but for some reason I can't figure out how to plot this. I tried to put a psgraph environment inside a pspicture environment inside a figure environment, but then the y-axis is scaled wrong:

\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}
\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}


Update

I've now managed to plot the data;

\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\AKonst{0.0264572}
\def\pKonst{0.095398}
% functions (something is wrong here)
\def\hFunk(#1){\AKonst*exp(-\bKonst/(2*\mKonst)*#1)}
% data
% 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}


but the three graphs are still giving me headaches. How do I plot these?

• External data is not needed because PSTricks can reproduce it via the given equation of motion and its parameters. – kiss my armpit Dec 25 '13 at 3:24
• @StiffJokes It is experimental data that I need to plot along with the fitted curve. :) If you can fix my problem, I'll be very glad. – Svend Tveskæg Dec 25 '13 at 3:31

it is COS and not 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\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)))
+\pKonst
%  0.0264572*Euler^(-0.506773*x)*COS(11.788*x+0.00694063)+0.095398
}

% data
(0,0.095398)(0,0.06)(5.25,0.13)[$t$~(s),0][$x$~(m),90]