4

I am trying to plot a couple of streamlines over a circle, defined as x^2 + y^2 - 4, so the radius is 2. I am trying plot using a function, specifically using PSTricks. However, I keep getting extra lines that I do not want like so:

enter image description here

Using an image editing program I just filled in the lines that I am not interested in with the colour blue.

The code I am using to generate the above image is:

\documentclass{article}
\usepackage{pst-func}
\begin{document}
\begin{pspicture}(-5, -5)(5, 5)
    \psaxes{<->}(0, 0)(-5, -5)(5, 5)[$x$, 0][$y$, 90]
    \psplotImp
    [
        algebraic,
        linecolor       = red,
        stepFactor      = 0.1
    ]
    (-5,-5)(5,5)
    {
        y - y * (y^2 + x^2 - 4)^-1 - 1.1
    }
\end{pspicture}
\end{document}

I am also trying to create a plot that plots many streamlines, how would I do this? If you look at the function, y - y * (y^2 + x^2 - 4)^-1 - 1.1, it is only 1.1 that would need to be changed, iteratively with a common difference of 0.1, in order to get different streamlines.

Any help would be so much appreciated!

nderjung
  • 727

1 Answers1

3

I'm not sure, what the actual problem in your document is, but the chapter about \psImpPlot in the pst-func documentation contains an example how to draw these stream lines. Here the adapted version for a circle with radius 2:

\documentclass[pstricks, margin=5pt]{standalone}
\usepackage{pst-func}
\begin{document}
\begin{pspicture*}(-5,-3.2)(5.5,4.5)
  \pscircle(0,0){2}%
  \psaxes{->}(0,0)(-5,-3)(5.2,4)%
  \multido{\rA=0.01+0.2}{5}{%
    \psplotImp[linewidth=1pt,linecolor=blue,polarplot](-6,-6)(5,2.6){%
      r 0.5 mul dup mul 2.0 r div sub phi sin dup mul mul \rA\space sub }}%
  \uput*[45](0,3){$f(r,\phi)=\left(r^2-\frac{1}{r}\right)\cdot\sin^2\phi=0$}
\end{pspicture*}
\end{document}

enter image description here

Christoph
  • 16,593
  • 1
  • 23
  • 47
  • How do I make this plot smooth? As of now the streamlines are not smooth and appear like steps. Is there any way to make the plots smooth? – Damitr Dec 18 '18 at 14:18
  • 1
    @Damitr See https://tex.stackexchange.com/a/8019 and the comments – Christoph Dec 18 '18 at 19:46