5

Consider the following code:

\documentclass{article}

\usepackage{pst-plot}

\begin{document}

% options
\psset{
  xunit = 5,
  yunit = 50
}
% constants.
\def\masse{0.183276667}  % kg
\def\kraft{0.0278661}    % N
\def\bKonst{0.012}       % kg/s
\def\omegaKonst{12.1278} % s^(-1)
% function
\def\amplitude(#1){\kraft/(\omegaKonst*\masse*sqrt(\omegaKonst^2*(#1)^4+(\bKonst^2/\masse^2-2*\omegaKonst^2)*(#1)^2+\omegaKonst^2))}
% data
\readdata{\resonans}{data-resonans.txt}
% plot
\begin{pspicture}(-0.21,-0.011)(1.83,0.191)
  \psaxes[
    dx = 0.2,
    Dx = 0.2,
    dy = 0.02,
    Dy = 0.005,
    comma
  ]{->}(0,0)(1.5,0.09)[$\omega_{\textup{SHB}}/\omega_{\textup{d}}$,0][$A$~(m),90]
  \listplot[
    plotstyle = dots,
    dotstyle = o,
    fillcolor = red
  ]{\resonans}
  \psplot[
    algebraic,
    plotpoints = 1000,
    linecolor = blue
  ]{0}{1.5}{\amplitude(x)}
\end{pspicture}

\end{document}

output

How do I get the same output as the following?

Mathematica

The data can be downloaded from http://gupl.dk/705814/.

4
  • 1
    Copy the data generated by Mathematica and paste it into filecontents* environment to make us easier to reproduce the problem. Jan 1 '14 at 11:34
  • @StiffJokes I completely forgot to link to the data (thanks for the pointer). See updated question. Jan 1 '14 at 11:36
  • @StiffJokes They come from an experiment and are collected using a computer. (Or is this not what you are asking for?) Jan 1 '14 at 16:10
  • 1
    @StiffJokes Found by computing other factors it depends on. Jan 1 '14 at 16:24
5
\documentclass{article}

\usepackage{pst-plot}
\usepackage{filecontents}

\begin{filecontents*}{data.dat}
[[0.6005832177,0.00371],[0.6618893637,0.00388],[0.7123448644,0.00246],[0.7324185582,0.00266],[0.7861292525,0.00328],[0.8523181889,0.00451],[0.9109116735,0.00647],[0.9282727060,0.00760],[0.9906639165,0.0114],[1.025928514,0.0152],[1.051970063,0.0222],[1.079096676,0.0131],[1.105138225,0.00865],[1.149625870,0.00549],[1.170242096,0.00455],[1.220155065,0.00336],[1.256504727,0.00267],[1.351990405,0.00184]]
\end{filecontents*}
\begin{document}

% options
\psset{
  xunit = 5,
  yunit = 200
}
% constants.
\def\masse{0.183276667}  % kg
\def\kraft{0.0278661}    % N
\def\bKonst{0.13831}       % kg/s
\def\omegaKonst{12.1278} % s^(-1)
% function
\def\amplitude{\kraft/(\omegaKonst*\masse)/%
  sqrt(\omegaKonst^2*x^4+(\bKonst^2/\masse^2-2*\omegaKonst^2)*x^2+\omegaKonst^2)}
% data
% plot
\begin{pspicture}(-0.21,-0.011)(1.83,0.021)
  \psaxes[
    Dx = 0.4,
    Dy = 0.005,
    comma
  ]{->}(0,0)(1.5,0.02)[$\omega_{\textup{SHB}}/\omega_{\textup{d}}$,0][$A$~(m),90]
\readdata{\resonans}{data.dat}
  \listplot[
    plotstyle = dots,
    dotstyle = o,
    fillcolor = red
  ]{\resonans}
  \psplot[
    algebraic,
    plotpoints = 5000,
    linecolor = blue,
    yMaxValue=0.08
  ]{0}{1.5}{\amplitude}
\end{pspicture}

\end{document}

enter image description here

And here the solution with values:

\documentclass{article}
\usepackage{pst-plot}
\usepackage{filecontents}

\begin{filecontents*}{data.dat}
[[0.6005832177,0.00371],[0.6618893637,0.00388],[0.7123448644,0.00246],[0.7324185582,0.00266],[0.7861292525,0.00328],[0.8523181889,0.00451],[0.9109116735,0.00647],[0.9282727060,0.00760],[0.9906639165,0.0114],[1.025928514,0.0152],[1.051970063,0.0222],[1.079096676,0.0131],[1.105138225,0.00865],[1.149625870,0.00549],[1.170242096,0.00455],[1.220155065,0.00336],[1.256504727,0.00267],[1.351990405,0.00184]]
\end{filecontents*}
\begin{document}

% options
\psset{
  xunit = 5,
  yunit = 200
}
% function
\def\amplitude{0.0125368/sqrt(147.084-293.598*x^2+147.084*x^4)}
% data
% plot
\begin{pspicture}(-0.21,-0.011)(1.83,0.03)
  \psaxes[
    Dx = 0.4,
    Dy = 0.005,
    dy=0.01,
    comma
  ]{->}(0,0)(1.5,0.03)[$\omega_{\textup{SHB}}/\omega_{\textup{d}}$,0][$A$~(m),90]
\readdata{\resonans}{data.dat}
  \listplot[
    plotstyle = dots,
    dotstyle = o,
    fillcolor = red
  ]{\resonans}
  \psplot[
    algebraic,
    plotpoints = 5000,
    linecolor = blue,
  ]{0}{1.5}{\amplitude}
\end{pspicture}

\end{document}

enter image description here

3
  • The fitting curve is wrong. (I'll updated my question with an answer at the bottom, in a few minutes.) Jan 1 '14 at 15:30
  • 1
    I edited my answer. Your equation was not the same as described in your image. However, you can modify it again. Important is the scaling.
    – user2478
    Jan 1 '14 at 16:09
  • For your first answer, why did you make \omegaKonst+\masse rather than \omegaKonst*\masse? Jan 1 '14 at 22:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.