Here is the code of a full answer that can be read as a pdf or directly:
\documentclass{article}
\usepackage{pgfplots}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\section{Ploting Mathematical Functions Using tikz or pgfplots}
Let's suppose we want to plot a function like this:
\begin{center}
\begin{tikzpicture}
\draw[-,blue!30!green] (0,0)to[out=0,in=225](1.5,1);
\draw[-,blue!30!green] (1.5,1)to[out=45,in=190](3,2);
\end{tikzpicture}
\end{center}
\subsection{The easy way (without real function):}
\subsubsection{Observe the function:}
We have just to pay attention to the properties of the function that has to be ploted. Here we need:
\begin{itemize}
\item The function has to start from about $(0,0)$ with almost zero (but possitive) derivative.
\item The function has to pass through $(1.5,1)$ with a derivative of about 1 (angle of $45^{\circ}$)
\item The function has to finish on point $(3,2)$ by a derivative of about 0 and possitive.
\end{itemize}
\subsubsection{tikz tools}
The tool we will use is the lines and arrows of tikz:
\begin{itemize}
\item An axis can be drawn with (here it is a x axis):
\verb|\draw[->,thick] (0,0)--(3.5,0);|
\begin{itemize}
\item In the above example (0,0) is the starting point and (3.5,0) is the finishing
point.
\item \verb|->| means ``draw arrow'' for tikz.
\item \verb|--| connects these two points with an arrow (because of the previous)
\end{itemize}
\item A grid can be ploted like this (here it is vertical lines between 0 and 3 by 0.5 units (of x) and between -0.2 and 2.5 (of y)):
\begin{verbatim}
\def\ymax{2.5}
\foreach \x in {0,0.5,...,3.5}{
\draw[-,thin] (\x,-0.2)--(\x,\ymax);}
\end{verbatim}
\begin{itemize}
\item In the above code\verb| \foreach| is a command that will be executed for each one of the values 0, 0.5, 1, 1.5 \ldots that are named (and can be used) as \verb|\x|
\item The line discribed before, but now it is a thin line.
\item In the finished example we will use two \verb|\foreach| commands to draw both $x$ and $y$ grids.
\end{itemize}
\item A curved line (here the function) can be drawn like this:
\verb|\draw[-] (0,0) to[out=10,in=235](1.5,1);|
\begin{itemize}
\item (0,0) and (1.5,1) are the starting and ending points.
\item \verb|out| is the angle which the line is going to follow to get out of the first point (See below).
\item \verb|in| is the angle which the line is going to follow to get in the second point.
\end{itemize}
We can remember the angles by creating imaginatively an analog clock where
3 o'clock is 0 degrees and 12 o'clock is 90 degrees etc:
\begin{tikzpicture}
\draw (2,-5) circle (3);
\node at (2,-5) {\LARGE clock};
\node (A)at (5,-5) {$0^\circ$};
\node (B)at (-1,-5) {$180^\circ$};
\node (C)at (2,-2) {$90^\circ$};
\node (D)at (2,-8) {$270^\circ$};
\node[rotate=45] (E)at (4.1,-2.9) {$45^\circ$};
\node at ([xshift=-1.cm]A) {3 o'clock=};
\node at ([xshift=1.2cm]B) {=9 o'clock};
\end{tikzpicture}
A line that starts with $45^{\circ}$ by the point (0,0) and ends to a point (2,0) by $160^{\circ}$ can be drawn whith the command
\verb|\draw (0,0)to[out=45,in=160](2,0);|:
\begin{tikzpicture}
\draw (0,0) circle (5pt);
\draw (2,0) circle (5pt);
\draw (0,0)to[out=45,in=160](2,0);
\end{tikzpicture}
\item A \verb|\node| is something that we will use here to add labels in the axes
The node command can be used with coordinates and conetent, but the most usefull thing we have to know here is that can optionally have an `anchor' to be left,or east, or below etc of the point like:
\verb|\node[left] at (3,2) {Content};|
\end{itemize}
\subsubsection{Plotting the function}
\begin{center}
\begin{tikzpicture}[scale=2.5]
\draw[->,thick] (-0.2,0)--(3.7,0);%x axis
\draw[->,thick] (0,-0.2)--(0,2.7);%y axis
\foreach \y in {0,0.5,...,2.5}{
\draw[-,thin] (0.,\y)--(3.5,\y);
\node[left] at (0,\y) {\y};
}
\foreach \x in {0,0.5,...,3.5}{
\draw[-,thin] (\x,0)--(\x,2.5);
\node[below] at (\x,0) {\x};
}
\draw[-,blue!30!green] (0,0)to[out=5,in=225](1.5,1);
\draw[-,blue!30!green] (1.5,1)to[out=45,in=185](3,2);
\end{tikzpicture}
\end{center}
\subsection{The math way (using -extracting- the fanction):}
We want the graph to pass through $(0,0)$\footnote{Condition 1} and $(3,2)$\footnote{Condition 2} in a way that in $(1.5,1)$\footnote{Condition 3}
has a zero second derivative\footnote{Condition 4} and at $(3,2)$\footnote{Not a real condition} the first direvative will be almost zero.
(4 conditions)
The known shape comes from a function like:
$$f(x)=\frac{\alpha}{\beta+1\cdot e^{-\gamma (x+t)}}$$
(4 parameters)\footnote{The value of 1 as a mulriplier to $exp$ function
is just one of our free selected constand, since if we use any value, $\alpha$ and $\beta$ can always be written in a way that gives the same final function}
\begin{itemize}
\item Condition 1:\\
$$f(0)\approx 0 \Longrightarrow \alpha<< \beta+e^{-\gamma(t)} \Longrightarrow$$
\begin{equation}\alpha-\beta<< e^{-\gamma t}\label{eq:1}\end{equation}
\item Condition 4:\\
$$f^{\prime\prime}(1.5)=0 \Longrightarrow$$
But every derivative will give a product of $\alpha$, $exp(-\gamma(x+t))$ and $(x+t)$... And only $x-t$ can get zero, Thus, by knowing that $x=1.5$:
\begin{equation}
t=-1.5
\end{equation}
\item Condition 2:\\
$$f(3)=2\Longrightarrow$$
\begin{equation}\label{eq:3}
\alpha=2\beta+2\cdot e^{-1.5\gamma}
\end{equation}
\item Condition 3:\\
Finally condition 3 gives:
$$f(1.5)=1\Longrightarrow$$
\begin{equation}
\alpha=\beta+1
\end{equation}
which combined with \eqref{eq:1} [if we want an errorof about 1\% units (the exp has to be about 100)in the last referred equation] gives:
$\gamma\approx3$
\begin{equation}
\gamma=3
\end{equation}
\end{itemize}
But Condition 2 (\eqref{eq:3})gives also:
$$\alpha=2\beta+2\cdot e^{-1.5\cdot3}\Longrightarrow$$
$$2\beta-\alpha=\beta-1=0.011\Longrightarrow$$
\begin{equation} \beta=1.011\end{equation}
And Finaly we got the function:
\begin{equation}f(x)=\frac{2.011}{(1.011+e^{-3(x-1.5)})}\end{equation}
\begin{tikzpicture}
\begin{axis}[grid=both,xmax=3.25,ymax=2.5]
\addplot[blue,domain=0.1:3,samples=300] {2.011/(1.011 + exp(-3*(x-1.5)))};
\end{axis}
\end{tikzpicture}
\end{document}
The above code generates this plot without using pgfplots or a formula, but with pure tikz curves:
And this after a mathematical analysis and a resulting formula:
Both codes (if you don't want to search all the above) are here:
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{center}
\begin{tikzpicture}[scale=2.5]
\draw[->,thick] (-0.2,0)--(3.7,0);%x axis
\draw[->,thick] (0,-0.2)--(0,2.7);%y axis
\foreach \y in {0,0.5,...,2.5}{
\draw[-,thin] (0.,\y)--(3.5,\y);
\node[left] at (0,\y) {\y};
}
\foreach \x in {0,0.5,...,3.5}{
\draw[-,thin] (\x,0)--(\x,2.5);
\node[below] at (\x,0) {\x};
}
\draw[-,blue!30!green] (0,0)to[out=5,in=225](1.5,1);
\draw[-,blue!30!green] (1.5,1)to[out=45,in=185](3,2);
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[grid=both,xmax=3.25,ymax=2.5]
\addplot[blue,domain=0.1:3,samples=300] {2.011/(1.011 + exp(-3*(x-1.5)))};
\end{axis}
\end{tikzpicture}
\end{center}
\end{document}
Conclusion:
As you can see, the math needed, (even if the "type" of the formula is "almost known") are sometimes more complex that a simple latex user background and other times can be simple enough. So, if you really want to "extrtact" the actual formula... such questions are somehow offtopic and could be minegrated here: https://math.stackexchange.com/
But you (almost) always have the ability to use a number of curves like done above on first approach and get a result close to what you expect.
-sin(\alpha x)+1
as marmot already mentioned... but could be a movedarctan()
too... But could be anyghing... I just started to write an answer for the linked post... but without knowing the function... and with knowing after the edit there... But the function could be anythingarctan
or a moved part ofsin
functions could be ok for our plot... But could not be ok too... So, we have sometimes ways to look for and to find the real formula (that is at most a mater of math.se than tex.se) but also we could just use a combination of curves approach that could be ok for our purpose. (These depends on the kind of our work etc)...sin
andarctan
could be used to construct a graph resembling your curve. But you say it "...could be ok for our plot... But could not be ok too.". Why wouldn't it be okay?