I need to plot a function within a paper I need to write. I don't want to capture a screenshot of the function. I want to do it with Pstricks, but I have had very bad luck with it. Every thing I have tried to do, fails one way or another. I don't know why.
This code was taken from the PSTRICK exapmples page (http://tug.org/PSTricks/main.cgi?file=pst-plot/examples).
Code: Select all
\listfiles
\documentclass[12pt,a4paper]{article} % Herbert Voss <voss@perce.de> 2004-06-26
\usepackage{pst-plot}
\usepackage{pstricks-add}
\usepackage{amsmath}
%
\def\pshlabel#1{\footnotesize#1}\def\psvlabel#1{\footnotesize#1}
%
\begin{document}
\psset{yunit=4cm,xunit=4}
\begin{pspicture}(-2,0)(2,1)
% \psgrid[griddots=10,gridlabels=0pt, subgriddiv=0]
\psaxes[Dy=0.25]{->}(0,0)(-2,0)(2,1)
\uput[-90](2,0){x}\uput[0](0,1){y}
\rput[lb](1,0.75){$\sigma =0.5$}
\rput[lb](-2,0.5){$f(x)=\dfrac{1}{\sigma\sqrt{2\pi}}\,e^{-\dfrac{x^2}{2\sigma{}^2}}$}
\psplot[linecolor=red, linewidth=2pt]{-1.8}{1.8}{%
/sigma 0.5 def
/e 2.718282 def
/C 1 sigma div 6.2831 sqrt div def
e x dup mul 2 div sigma dup mul div neg exp C mul}
\end{pspicture}
\begin{verbatim}
\usepackage{pst-plot}
\usepackage{pstricks-add}
\usepackage{amsmath}
%
\def\pshlabel#1{\footnotesize#1}\def\psvlabel#1{\footnotesize#1}
%
\begin{document}
\psset{yunit=4cm,xunit=4}
\begin{pspicture}(-2,0)(2,1)
% \psgrid[griddots=10,gridlabels=0pt, subgriddiv=0]
\psaxes[Dy=0.25]{->}(0,0)(-2,0)(2,1)
\uput[-90](2,0){x}\uput[0](0,1){y}
\rput[lb](1,0.75){$\sigma =0.5$}
\rput[lb](-2,0.5){$f(x)=\dfrac{1}{\sigma\sqrt{2\pi}}\,e^{-\dfrac{x^2}{2\sigma{}^2}}$}
\psplot[linecolor=red, linewidth=2pt]{-1.8}{1.8}{%
/sigma 0.5 def
/e 2.718282 def
/C 1 sigma div 6.2831 sqrt div def
e x dup mul 2 div sigma dup mul div neg exp C mul}
\end{pspicture}
\end{verbatim}
\end{document}
The same thing occurs with psset and other commands

Any suggestions??
Thanks in advance.