[pstricks] Smoothing Logistic Curves
Rich Shepard
rshepard at appl-ecosys.com
Mon Oct 26 19:26:37 CET 2009
Thanks to Michael Sharpe (for the PostScript code for logistic and
Gaussian curves) and Herbert Voss for fine-tuning the axes template code,
I'm much closer to achieving what I need, and understanding what I'm doing,
too.
The following code produces a nice S-curve (a logistic curve) over a large
domain on the x-axis. I assume that the jagged changes at the lower left and
upper right are the results of the asymptotic approach to the limits of the
y-axis. Is there a way to make the curve appear more smooth near the
extremes?
\documentclass[letterpaper,10pt]{article}
\usepackage{pstricks-add,pst-func}
\makeatletter
\pst at addfams{pst-morefunc}
\define at key[psset]{pst-morefunc}{sigma}{\def\psk at sigma{#1 }\def
\psk at var{#1 #1 mul }}
\define at key[psset]{pst-morefunc}{var}{\def\psk at var{#1 }\def
\psk at sigma{#1 sqrt }}
\define at key[psset]{pst-morefunc}{mu}{\def\psk at mu{#1 }}
\define at key[psset]{pst-morefunc}{lscale}{\def\psk at lscale{#1 }}
\def\gaussfn{ Euler x \psk at mu sub dup mul 2 div \psk at var div neg exp }
\def\Scurve{1 1 Euler x \psk at mu sub \psk at lscale div neg exp add div }
\def\Zcurve{Euler x \psk at mu sub \psk at lscale div neg exp dup 1 add div }
\makeatother
\begin{document}
\psset{axesstyle=axes,Dx=10,Dy=0.25,tickstyle=bottom,
llx=-1.5cm,lly=-1.1cm,urx=1mm,ury=1mm,
xAxisLabel=Domain,xAxisLabelPos={c,-0.2},
yAxisLabel={Membership Grade ($\mu$)},yAxisLabelPos={-14,c}}
\begin{psgraph}(0,0)(100,1){10cm}{5cm}
\psplot[mu=50,lscale=10,linewidth=1.0pt,linecolor=blue]{0}{100}{\Scurve}
\end{psgraph}
\end{document}
--
Richard B. Shepard, Ph.D. | Integrity Credibility
Applied Ecosystem Services, Inc. | Innovation
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863
More information about the PSTricks
mailing list