1

I'm trying to make a StreamPlot in Mathematica with three variables. I already have two variables, x and y, that make an ellipse via

StreamPlot[{-y,x}] 

but I want the vectors to increase as you move radially out from the center (ie ideally I would want a third variable, v, so that it looked like

StreamPlot[{-v*y, v*x}] 

So that as v increased the vectors increased as well.

chris
  • 22,860
  • 5
  • 60
  • 149
pelkat
  • 11
  • 1
  • You might take a look at VectorPlot. – march Jun 16 '15 at 16:14
  • I'm not sure I follow, but it sounds like you're looking for the formula of a vector field in just two variables with such a property. Something like Norm[{x, y}]*{-y, x}. – Michael E2 Jun 16 '15 at 16:18
  • I'm also not sure what you're looking for; rescaling the vectors as you propose won't change the stream lines at all. Are you looking for the actual arrowheads & lines in StreamPlot to be rescaled according to their location on in the plot? – Michael Seifert Jun 16 '15 at 16:38
  • Yes, @MichaelSeifert, that's what I'm looking for. The farther you go out from the center, I want the actual lines to be larger. What I'm doing is making an ellipse, and as you move outward the velocity around the ellipse should increase. – pelkat Jun 16 '15 at 16:47
  • The vector field {x,-y} produces sets of lines that converge to x=0, not an ellipse – pelkat Jun 16 '15 at 16:54
  • @Katie Right, sorry: I had an error. I would still suggest using VectorPlot. I'm pretty sure it's exactly what you want. – march Jun 16 '15 at 17:07
  • The problem with VectorPlot is that the number of variables has to match the number of expressions- I can't simply add in another variable to my ellipse – pelkat Jun 16 '15 at 17:19
  • @Katie: VectorPlot scales the vectors automatically, in (I think) exactly the way you want, and there is an option VectorScale that allows you to change how the vectors scale. There is also an option in StreamPlot called StreamScale which will do what you want (I think). Check out the documentation for more information on these. – march Jun 16 '15 at 18:11
  • Did the answer below answer your question? It is customary to accept a solution by by clicking the checkmark sign if it has actually solved your problem. If I haven't, please let me know how I can offer further help. – march Jun 19 '15 at 16:53

1 Answers1

5

There is an option in StreamPlot called StreamScale that allows you to scale the vectors. In the documentation, we find that StreamScale -> {Automatic, 2, Automatic} results in scaled vectors. Alternatively, you can use VectorPlot, which automatically scales the vectors. Using

StreamPlot[{-y,x}, {x,-2,2}, {y,-2,2}, StreamScale -> {Automatic, 2, Automatic}]
VectorPlot[{-y,x}, {x,-2,2}, {y,-2,2}]

the results look like (with StreamPlot on the left and VectorPlot on the right):

enter image description here

Also see, for instance, Getting clearer StreamPlot output, How to get StreamPlot to draw many hundreds of streamlines?, and How can I get better control over StreamPlot? for more information about how StreamPlot works.

march
  • 23,399
  • 2
  • 44
  • 100