4

I am not sure why this doesn't work. At first I thought the issue was x values close to zero. So I broke it up into two separate graphs that ignored x values close to zero. I have tried copying code snippets form others. Theirs works (using different function to graph), but mine does not.

The error I get is:! PGF Math Error: p' orp(' in {2500*exp(0.05*-10.0)/(100+25*(exp(0.05*-10.0)-1))}')

\documentclass{standalone}

\usepackage{tikz}

\begin{document}

\begin{center}
    \begin{tikzpicture}[scale=0.1]
            \draw [<->,very thick] (0,-10) -- (0,100) node [above] {$y$};
            \draw [<->,very thick] (-10,0) -- (160,0) node [right] {$x$};
            \draw [domain=-10:160,samples=1000] plot (\x,{2500*exp(0.05*\x)/(100+25*(exp(0.05*\x)-1))});
        \end{tikzpicture}
\end{center}
7

It is because the dimension is too large to plot. A work around is to rewrite the function to be plotted in a way that it won't cause dimension too large error.

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\begin{document}
    \begin{tikzpicture}[scale=0.1]
            \draw [<->,very thick] (0,-10) -- (0,100) node [above] {$y$};
            \draw [<->,very thick] (-10,0) -- (160,0) node [right] {$x$};
            \draw [domain=-10:160,samples=100] plot (\x,{100/(1+3*(exp(-0.05*\x))});
        \end{tikzpicture}
\end{document}

enter image description here

  • 1
    Thank you so much...this works great. I had fun reproducing the math as well. – Garth Fleming Dec 11 '18 at 7:03
6

For comparism purpose. Run with xelatex

\documentclass[pstricks]{standalone}
\usepackage{pst-plot}
\begin{document}

\begin{psgraph}[Dx=25,Dy=25,llx=-0.5,lly=-0.5,
     urx=0.5,ury=0.5,xAxisLabel=$x$,
     yAxisLabel=$y$]{->}(0,0)(-15,-10)(160,110){10cm}{8cm}
 \psplot[plotpoints=1000,algebraic,linewidth=1.5pt,
   linecolor=blue]{-10}{160}{2500*Euler^(0.05*x)/(100+25*(Euler^(0.05*x)-1))}
\end{psgraph}   

\end{document}

enter image description here

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.