[pstricks] Drawing S- and Z-Curves
Michael Sharpe
msharpe at ucsd.edu
Sun Apr 26 02:31:16 CEST 2009
Rich,
Here's my re-edit of your material, which works correctly. I see I
wrote something wrong the first time, omitting the factor of 2 in the
normal density.
\documentclass{article}
\usepackage{pstricks-add}
\usepackage{amsmath}
\pagestyle{empty}
%
\def\pshlabel#1{\footnotesize#1}\def\psvlabel#1{\footnotesize#1}
%
\begin{document}
\psset{yunit=4cm,xunit=2cm}
\begin{pspicture}(-2,0)(2,1)
\psset{plotpoints=500, plotstyle=line}
\uput[-90](2,0){x}
\uput[0](0,1){y}
\rput(1,0.75){$\sigma =0.5$}
% a=0.0 b=2.0 m=1.5 v=0.5
\psplot[algebraic]{0.0}{2.0}{Ex(-(x-1.0)^2/0.5)}
\end{pspicture}
\end{document}
The package pstricks-add (not pst-add) loads the other packages---save
typing.
You had some confusing settings---good to put actual dimensions on
xunit, yunit.
The algebraic option of pstricks-add is well described in pstricks-
add.doc.pdf (texdoc pstricks-add, at the command line.)
Michael
On Apr 25, 2009, at 5:01 PM, Rich Shepard wrote:
> On Tue, 21 Apr 2009, Michael Sharpe wrote:
>
>> For the bell shaped curve with value 1 at x=m, variance v, plotted
>> from x=a to x=b, you could use
>> \psplot[algebraic]{a}{b}{Ex(-(x-m)^2/v)}
>> where, of course, specific numbers should be substituted for m, v,
>> a, b.
>>
>> A similar expression can be constructed for the particular logistic
>> curve (S-curve) you need, possibly expressed most simply using \tanh,
>> written th in algebraic formulas. Eg
>> \psplot[algebraic]{a}{b}{(1+th(x/2))/2}
>
> Michael,
>
> Thank you very much. I have been unsuccessful looking for
> documentation on
> how to use the algebraic option for \psplot. Trying to emulate the
> Gaussian
> plot example on the PSTricks example pages, but without the embedded
> PS, my
> latest attempt is here:
>
> \documentclass[letterpaper,10pt]{article}
> \usepackage{pstricks}
> \usepackage{pst-plot}
> \usepackage{pst-add}
> \usepackage{amsmath}
> \pagestyle{empty}
> %
> \def\pshlabel#1{\footnotesize#1}\def\psvlabel#1{\footnotesize#1}
> %
> \begin{document}
> \psset{yunit=4cm,xunit=4}
> \begin{pspicture}(-2,0)(2,1)
> \psset{xunit=2, plotpoints=500, plotstyle=line}
> \uput[-90](2,0){x}\uput[0](0,1){y}
> \rput[lb](1,0.75){$\sigma =0.5$}
> % a=0.0 b=2.0 m=1.5 v=0.5
> \psplot[algebraic]{0.0}{2.0}{Ex(-(x-3.0)^2/0.5)}
> \end{pspicture}
> \end{document}
>
> And I would greatly appreciate a clue stick nudging me to the
> proper way
> to write these.
>
> Thanks,
>
> Rich
> _______________________________________________
> PSTricks mailing list
> PSTricks at tug.org
> http://tug.org/mailman/listinfo/pstricks
>
More information about the PSTricks
mailing list