1

Fixed a problem in drawing graphs using Gnuplot and without it in tikz package.

code1: need gnuplot

\documentclass[tikz,border=3.14mm]{standalone}

\def\A{2.5}
\def\V{0.8}
\def\q{0.8}

\begin{document}

\begin{tikzpicture}
\draw[->] (0,0) -- (5,0) node[below] {$x$};
\draw[->] (0,0) -- (0,3) ;

\draw[color=green!30!black, very thick, smooth]plot[id=x, domain=0:5] function{\A*(1-exp(-log(2)*(x)/\V))};

\draw[dashed] (0,\A) node[left] {$\theta_a$} -- (5,\A);
\draw[dashed, color=red] (0,\q*\A)node[left] {$q\theta_a$} -- (5,\q*\A);
\draw[dashed, color=red] (\V+1.07,0)node[below] {$\vartheta_q$} -- ++(0,3);
\draw[dashed] (-0.2,-0.4) -- (1.5,3);
\end{tikzpicture}

\end{document}

Output: draw functoin

\draw[color=green!30!black, very thick, smooth]plot[id=x, domain=0:5] function{\A*(1-exp(-log(2)*(x)/\V))};

enter image description here

code2: without gnuplot

\documentclass[tikz,border=3.14mm]{standalone}

\def\A{2.5}
\def\V{0.8}
\def\q{0.8}

\begin{document}

\begin{tikzpicture}
\draw[->] (0,0) -- (5,0) node[below] {$x$};
\draw[->] (0,0) -- (0,3) ;

\draw[color=green!30!black, very thick, smooth,domain=0.1:5] plot (\x,{\A*(1-exp(-log2(\x)/\V))});

\draw[dashed] (0,\A) node[left] {$\theta_a$} -- (5,\A);
\draw[dashed, color=red] (0,\q*\A)node[left] {$q\theta_a$} -- (5,\q*\A);
\draw[dashed, color=red] (\V+1.07,0)node[below] {$\vartheta_q$} -- ++(0,3);
\draw[dashed] (-0.2,-0.4) -- (1.5,3);
\end{tikzpicture}

\end{document}

output: change function to

\draw[color=green!30!black, very thick, smooth,domain=0.1:5] plot (\x,{\A*(1-exp(-log2(\x)/\V))});

enter image description here

Note: I'm trying to draw without gnuplot. Thanks for the help.

Is there a problem converting the function!?

3
  • The function in code2 is different than in code1. I think it should be plot (\x,{\A*(1-exp(-ln(2)*(\x)/\V))});.
    – luki
    Mar 17, 2020 at 13:20
  • Thanks Solved, number 2 in my logarithm I thought was basic. log(2)=ln(2)!
    – M.Ahmadi
    Mar 17, 2020 at 13:31
  • @luki , Please write in the answer to close the question. Thanks.\draw[color=green!30!black, very thick, smooth,domain=0:5] plot (\x,{\A*(1-exp(-ln(2)*(\x)/\V))});
    – M.Ahmadi
    Mar 17, 2020 at 13:41

1 Answer 1

0

In the function of code2 you should change log2(\x) to ln(2)*(\x) to use the natural logarithm:

\documentclass[tikz,border=3.14mm]{standalone}

\def\A{2.5}
\def\V{0.8}
\def\q{0.8}

\begin{document}

\begin{tikzpicture}
\draw[->] (0,0) -- (5,0) node[below] {$x$};
\draw[->] (0,0) -- (0,3) ;

\draw[color=green!30!black, very thick, smooth,domain=0.1:5] plot (\x,{\A*(1-exp(-ln(2)*(\x)/\V))});

\draw[dashed] (0,\A) node[left] {$\theta_a$} -- (5,\A);
\draw[dashed, color=red] (0,\q*\A)node[left] {$q\theta_a$} -- (5,\q*\A);
\draw[dashed, color=red] (\V+1.07,0)node[below] {$\vartheta_q$} -- ++(0,3);
\draw[dashed] (-0.2,-0.4) -- (1.5,3);
\end{tikzpicture}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .