1
$\begingroup$

I am trying plot vector field of a dynamical system together with highlighting some area using some inequality constraints.

My state-variable for vector fields are $x$ and $y$.

The following are the parameters used for the vector field

ls = 2*10^-3; 
cs =  2*10^-3; 
g = 0.03; 
p1 = 1000; 
pi1 = 1100; 
is = 0; 
ki = 0; kd = 1; yd = 380;

The vector fields are given by f1 and f2:

f1 = -(pi1/y^2 + kd)* cs^-1*(x - g*y - p1/y - is) - (ki + ls^-1)*(y - yd);
f2 = cs^-1*(x - g*y - p1/y - is);

I have used the following code to Draw the vector SteamDensity plot

StreamDensityPlot[
 {f1, f2}, {x, xd - 100, xd + 100}, {y, yd - 100, yd + 100},
 StreamPoints -> {{{{xd, yd}, Blue}, {{xd - 50, yd - 50}, 
     Green}, {{xd + 50, yd + 50}, Red}, Automatic}},
 PlotRange -> {{xd - 100, xd + 100}, {yd - 100, yd + 100}},
 FrameTicks -> {{-50, {14, 
     "\!\(\*SuperscriptBox[\(I\), \(*\)]\)=14 A", {.5, 0}, 
     Thickness[0.001]}, 50}, {250, 300, 
    350, {380, "\!\(\*SuperscriptBox[\(V\), \(*\)]\)=380 V", {.5, 0}, 
     Thickness[0.001]}, 450}},
 AspectRatio -> 1,
 FrameLabel -> {Current  , Voltage },
 PlotLegends -> Automatic,
 PlotTheme -> "Monochrome",
 StreamPoints -> Fine,
 TicksStyle -> Directive[Orange, 50]
 ]

This resulted in the following plot:

Stream plot

However, I am want to highlight the area inside the plot satisfying $370<y<410$. I checked all the option of StreamDensityPlot but didn't find any relevant function that does this.

$\endgroup$
2
$\begingroup$

Try putting a Rectangle in Epilog:

StreamDensityPlot[{f1, f2}, {x, xd - 100, xd + 100}, {y, yd - 100, 
  yd + 100}, 
 StreamPoints -> {{{{xd, yd}, Blue}, {{xd - 50, yd - 50}, 
     Green}, {{xd + 50, yd + 50}, Red}, Automatic}}, 
 PlotRange -> {{xd - 100, xd + 100}, {yd - 100, yd + 100}}, 
 FrameTicks -> {{-50, {14, 
     "\!\(\*SuperscriptBox[\(I\), \(*\)]\)=14 A", {.5, 0}, 
     Thickness[0.001]}, 50}, {250, 300, 
    350, {380, "\!\(\*SuperscriptBox[\(V\), \(*\)]\)=380 V", {.5, 0}, 
     Thickness[0.001]}, 450}}, AspectRatio -> 1, 
 FrameLabel -> {Current, Voltage}, PlotLegends -> Automatic, 
 PlotTheme -> "Monochrome", StreamPoints -> Fine, 
 TicksStyle -> Directive[Orange, 50],
 Epilog -> {Orange, Opacity[0.5], 
   Rectangle[{xd - 100, 370}, {xd + 100, 410}]}]

Mathematica graphics

|improve this answer|||||
$\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.