0
$\begingroup$

I am trying to use StreamPlotDensity to find the direction of my electric field at a point x,y. My electric field is given as

ElecticField={((E^-(x^2 + y^2)^2) (x^2 + y^2) Cos[2 Pi])^2 + ((E^-(x^2 + y^2)^2) (x^2 + y^2) Cos[2 Pi])^2}

Now when I use PlotDensity for this electric field with the code

 DensityPlot[{((E^-(x^2 + y^2)^2) (x^2 + y^2) Cos[2 Pi])^2 + ((E^-(x^2 + y^2)^2) (x^2 + y^2) Cos[2 Pi])^2}, {x, -3, 3}, {y, -3, 3}, PlotTheme -> "Minimal", 
 PlotRange -> All, PlotPoints -> 50, ColorFunction -> "Rainbow"]

To get

enter image description here

Now when I use the following StreamDensityPlot code

StreamDensityPlot[{((E^-(x^2 + y^2)^2) (x^2 + y^2) Cos[
     2 Pi]), ((E^-(x^2 + y^2)^2) (x^2 + y^2) Cos[2 Pi])}, {x, -3, 
  3}, {y, -3, 3}, PlotTheme -> "Minimal", PlotRange -> All, 
 ColorFunction -> "Rainbow"]

I get the image

enter image description here

Now my issue is that the image is not showing the direction lines for all parts of the plot and that the plot is not looking how the DensityPlot one does. Can you please provide some help regarding this

Essentially what I am trying to do is create a plot of my electric field and show the direction of it at a point x,y.

Thank you for all your help

$\endgroup$
4
  • $\begingroup$ Look at the velocity field in "StreamDensityPlot". The x and y component are identical. Therefore you get diagonal stream lines. $\endgroup$ May 17, 2021 at 10:55
  • $\begingroup$ @DanielHuber, Thank you for your answer, I am not totally sure what you mean by the x and y component are exactly the same. Could you please elaborate. Thanks $\endgroup$ May 18, 2021 at 7:51
  • $\begingroup$ The vector in "StreamPlot": t = {((E^-(x^2 + y^2)^2) (x^2 + y^2) Cos[ 2 Pi]), ((E^-(x^2 + y^2)^2) (x^2 + y^2) Cos[2 Pi])}; t[[1]] == t[[2]] has identical x and y components $\endgroup$ May 18, 2021 at 8:41
  • $\begingroup$ Thank you @DanielHuber I understand the issue now. $\endgroup$ May 18, 2021 at 15:42

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.