6

I'm trying to plot a simple math function in 3D using the package pst-3dplot. The function is z = 1/(1+a*exp(-b*y)) * (c * (1 - exp(d*x)) * (1 - exp(e*(x-f)))).

I tried the following:

\def\PsEuler{2.71828182846}
\psset{xunit=0.5cm,yunit=0.5cm}
\begin{pspicture}(-5,0)(10,10)
    \psset{Beta=15,nameX=$x_1$,nameY=$x_2$,nameZ=$x_3$}
    \pstThreeDCoor[IIIDticks,IIIDlabels,xMin=0,xMax=120,yMin=0,yMax=1,zMin=0,zMax=12,Dx=1,Dy=0.01,Dz=1]
    \infixtoRPN{ 1/(1+300*\PsEuler^(-10*y)) * (11.06 * (1 - \PsEuler^(-0.214*x)) * (1 - \PsEuler^(0.02667*(x-113)))) }
    \psplotThreeD[yPlotpoints=50,xPlotpoints=50,hiddenLine=true](0,120)(0,1){\RPN}
\end{pspicture}

The function is correctly shown between [0,1] on the y-axis, but I didn't succeed in streching the y-axis. I have 10 units in both the x-z axis and 1 unit in the y-axis and the function looks like very "crushed" in this direction. I tried the Dy = 0.1 in order to "strech" the y-axis and plot 10 units of values 0.1. It doesn't work. If I set

\psplotThreeD[...](0,120)(0,10){\RPN} 

it plots the function on the y-axis from 0 to 1 (step 0.1) but the function is not correctly drawn (in fact the result is the function between [0,10] in the y-axis but with an incorrect y-scale).

I double checked the function with Matlab and it is correctly plotted. Any suggestions would be greatly appreciated.

5

it makes more sense to use pst-solides3dif you want hidden lines. For a better view I choosed 10*x and y/10 for the coordinates. The x/y-values for the function are divided/multiplied to get the (0...120)(0...1) interval

\documentclass[pstricks]{standalone}
\usepackage{pst-solides3d}
\begin{document}

\psset{viewpoint=30 50 10 rtp2xyz,Decran=15}

\begin{pspicture}(-6.5,-5)(5,7)
\psSurface[algebraic,ngrid=0.2 0.2 ](0,0)(12,10){
     1/(1+300*Euler^(-y))*(11.06*(1 -Euler^(-2.14*x))*(1-Euler^(0.02667*(10*x-113))))}
\end{pspicture}

\end{document}

enter image description here

the same with axes:

\documentclass[pstricks]{standalone}
\usepackage{pst-solides3d}
\begin{document}
\psset{viewpoint=40 60 10 rtp2xyz,Decran=15}

\begin{pspicture}(-6,-5)(5,6)
\psSurface[algebraic,ngrid=0.25 0.25,axesboxed,Zmax=10 ](0,0)(12,10){
     1/(1+300*Euler^(-y))*(11.06*(1 -Euler^(-2.14*x))*(1-Euler^(0.02667*(10*x-113))))}
\end{pspicture}

\end{document}

enter image description here

  • Great, very impressive. Did not knew pst-solides3d but sounds very good. Thanks for the tip – Grasshoper Mar 25 '13 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.