3
$\begingroup$

in a phase diagram appear vectors that go in different directions. When graphing with the "streamplot" or "vectorplot" command, only the arrows appear showing how they move away from or closer to balance. Well, I would like to know how to divide a vector into two arrows that indicate how it grows on each axis "x" and "y". (i put in red that i need). Thanks :D

enter image description here

Show[Plot[{(8 + x)/4, 1/2 (-3 - x)}, {x, -10, 10}], 
 StreamPlot[{-x + 4 y - 8, x + 2 y + 3}, {x, -10, 10}, {y, -6, 6}, 
  StreamStyle -> LightCyan, 
  VectorPoints -> {{-10, 2}, {-5, 4}, {-5, -4}, {6, -3}}, 
  VectorScale -> .15]]
$\endgroup$
5
$\begingroup$

You could use the Projection function here to good use. First make the StreamPlot:

sp = Show[Plot[{(8 + x)/4, 1/2 (-3 - x)}, {x, -10, 10}], 
  StreamPlot[{-x + 4 y - 8, x + 2 y + 3}, {x, -10, 10}, {y, -6, 6}, 
  StreamStyle -> LightCyan, 
  VectorPoints -> {{-10, 2}, {-5, 4}, {-5, -4}, {6, -3}}, 
  VectorScale -> .15, VectorMarkers -> Placed["Arrow", "Start"]]]

Mathematica graphics

Then make the projections:

vp = VectorPlot[{Projection[{-x + 4 y - 8, x + 2 y + 3}, {1, 0}], 
  Projection[{-x + 4 y - 8, x + 2 y + 3}, {0, 1}]}, {x, -10, 10}, {y, -6, 6},
  VectorStyle -> Red, 
  VectorPoints -> {{-10, 2}, {-5, 4}, {-5, -4}, {6, -3}}, 
  VectorScale -> .15, VectorMarkers -> Placed["Arrow", "Start"]]

Mathematica graphics

Of course you can style the vectors as you please. Then combine:

Show[sp, vp, PlotRange -> All]

Mathematica graphics

$\endgroup$
  • $\begingroup$ When i put VectorMarkers -> Placed["Arrow", "Start"] returns error, can you help me? pls thax bro $\endgroup$ – Relayy ekko Jun 11 at 22:36
  • $\begingroup$ @Relayyekko What version are you using? $\endgroup$ – chuy Jun 12 at 13:26
3
$\begingroup$

Using VectorPlot:

{f1, f2} = {(8 + x)/4, 1/2 (-3 - x)};
{gx, gy} = {-x + 4 y - 8, x + 2 y + 3};
Show[
 Plot[{f1, f2}, {x, -10, 10}],

 StreamPlot[{gx, gy}, {x, -10, 10}, {y, -6, 6}, StreamStyle -> Cyan],

 VectorPlot[{{gx, gy}, {gx, 0}, {0, gy}}, {x, -10, 10}, {y, -6, 6},
  VectorStyle -> {Black, Red, Blue},
  VectorPoints -> {{-10, 2}, {-5, 4}, {-5, -4}, {6, -3}},
  VectorScale -> .15,
  VectorMarkers -> Placed["Arrow", "Start"]],

 ImageSize -> 300, Frame -> True ]

enter image description here

$\endgroup$

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.