Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to make a plot of a function that has an overshoot of 25% and then settles with subtle oscillations at 100%. I would like to create it in one of the listed packages or in gnus case add on to PGFPlots. Unfortunately, I don't know the function I just have an image so I don't know how to start creating it.

enter image description here

share|improve this question
1  
Isn't that ultimately a problem of mathematics not TeX? Even if you can't find the function, you could presumably do a scan, work out the point positions and plot them. –  Joseph Wright Mar 29 at 19:07
    
@JosephWright I am not necessarily looking for an exact plot just something that has this behavior since we can always re label the axes. I think it may be possible to mimic this with TeX alone. I just don't know where or how to start without the equation. –  dustin Mar 29 at 19:13
4  
My point is you have to have something to plot, but that has nothing to with TeX. –  Joseph Wright Mar 29 at 19:22
1  
This looks like the response of a controller, e.g. a PID controller. –  Psirus Mar 29 at 19:23
2  
It is an under-damped oscillator which is commonly explained in RLC circuit or its mechanical dual. –  Who is crazy first Mar 29 at 19:35

2 Answers 2

Just for a starting point. It is not a complete answer.

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-plot}
\pstVerb
{
    /xi .125 def
    /tau .25 def
    /rho {xi 2 exp neg 1 add sqrt} def
    /amp 3 def
}
\def\f(#1){amp*(1-3^(-xi*(#1)/tau)*(cos((#1)*rho/tau)+sin((#1)*rho/tau)*xi/rho))}
\begin{document}
\begin{pspicture}[plotpoints=300](-1,-1)(11,7)
\psaxes[labels=none,ticks=none]{->}(0,0)(-1,-1)(10.5,6.5)[$t$,0][$v(t)$,90]
\psplot[algebraic,linecolor=blue,linewidth=2pt]{0}{10}{\f(x)}
\end{pspicture}
\end{document}

enter image description here

share|improve this answer
up vote 2 down vote accepted

So I have been able produce the following:

\documentclass[tikz, convert = false]{standalone}
\usepackage[utf8]{inputenx}%  http://ctan.org/pkg/inputenx
% Euler for math | Palatino for rm | Helvetica for ss | Courier for tt
\renewcommand{\rmdefault}{ppl}% rm
\linespread{1.05}% Palatino needs more leading
\usepackage[scaled]{helvet}% ss //  http://ctan.org/pkg/helvet
\usepackage{courier}% tt // http://ctan.org/pkg/courier
\usepackage{eulervm}  %  http://ctan.org/pkg/eulervm
% a better implementation of the euler package (not in gwTeX)
\normalfont%
\usepackage[T1]{fontenc}%  http://ctan.org/pkg/fontenc
\usepackage{textcomp}%  http://ctan.org/pkg/textcomp

\usepackage{pgfplots}
\pgfplotsset{compat = 1.9}
\pgfmathsetmacro\z{0.403713}
\pgfmathsetmacro\w{343.386319715305}
\begin{document}
\begin{tikzpicture}
  \begin{axis}[
    ymax = 1.3,
    ymin = 0,
    xmin = 0,
    xmax = .05,
    ytick = {0, 1.25},
    xtick = {0, 0.01},
    axis x line = center,
    axis y line = left,
    xlabel = {$t(sec)$},
    ylabel = {$y(t)$}
    ]
    \addplot[blue, samples = 100, smooth]
    gnuplot[id = exp, domain = 0:.05]
    {1 - exp(-\z*\w*x)/sqrt(1 - \z^2)*sin(\w*x*sqrt(1 - \z^2) + 1/cos(\z))};
  \end{axis}
\end{tikzpicture}
\end{document}

enter image description here

How can I change 1*10^{-2} to display as 0.01?

share|improve this answer
1  
For your question, use scaled x ticks=false and x tick label style={/pgf/number format/fixed} in the axis options. –  Paul Gessler Mar 29 at 20:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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