3
$\begingroup$

I am trying to plot some vector fields using StreamPlot, but I am unable to get the desired plot as some options are ignored when I add them.

Here is the vector field I am trying to plot:

\[Alpha] = Pi/4*(x + y);
Q = {{Cos[\[Alpha]], -Sin[\[Alpha]]}, {Sin[\[Alpha]], Cos[\[Alpha]]}};

And here is the plot:

\[CapitalOmega] = Rectangle[{0, 0}, {1, 1}];
StreamPlot[Q . {{1}, {0}}, {x, y} \[Element] \[CapitalOmega], 
 StreamPoints -> Coarse,
 StreamMarkers -> "Segment", 
 StreamStyle -> Thickness[0.003], 
 StreamColorFunction -> (GrayLevel[0.35] &), 
 RegionFillingStyle -> LightGray, 
 RegionBoundaryStyle -> GrayLevel[0.35]]

The code above produces the following result:Result

As we can see, the options StreamMarkers and Thickness are ignored, as the plot looks the same, if the are omitted. Any idea how to change arrows to lines and set their thickness?

$\endgroup$

1 Answer 1

6
$\begingroup$

Your problems come from wrong syntax:

Q . {{1}, {0}}

This results in a matrix, not a vector. In MMA there is no distinction between row and column vector. Instead, the rule is:

Summation is done over the last index of the left object and the first index of the right object.

Therefor you need to write:

Q . {1, 0}

StreamPlot[Q . {1, 0}, {x, y} \[Element] \[CapitalOmega], 
 StreamPoints -> Coarse, StreamMarkers -> "Segment", 
 StreamStyle -> Thickness[0.003], 
 StreamColorFunction -> (GrayLevel[0.35] &), 
 RegionFillingStyle -> LightGray, 
 RegionBoundaryStyle -> GrayLevel[0.35]]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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