4
$\begingroup$

I have an electric field,

Elec[d_, w_, q_, r_, t_] = -((q accel)/(4 \[Pi] Subscript[\[Epsilon], 0] r c^2))
Subscript[\[Epsilon], 0] :=  8.85*10^-12
c := 3*10^8

Where accel is a vector shown as below

{0, 1/4 Sqrt[3] d w^2 Cos[t w], -(1/4) d w^2 Cos[t w]}

This is how my output looks:

Elecfield

This is how my animation looks

Animate[Plot[Elec[1, 1, 1 , 1000, t + l], {t, 0, 10}, 
  PlotRange -> 0.0000000001], {l, 0, 10} ]

elecanimate

I want to make it so that I get one single wave to show up, but in 3D. The wave should be the average of the two in both magnitude and direction. I was wondering what function or set of functions I could use to achieve my goal?

Another question if i may, I have a magnetic field,

B[d_, w_, q_, r_, t_] = R \[Cross]Elec[d, w, q, r, t]/c

Where R is:

R =  {0, 1/2, \[Sqrt]3/2}

Here's a picture of my code

Magneticfield

How can I made this into a 3D wave from my current animation?

Animate[Plot[B[1, 1, 1 , 1000, t + l], {t, 0, 10}, 
  PlotRange -> 0.0000000000000000003], {l, 0, 10} ]

Animation

These waves are all travelling in the Z direction, with the Magnetic wave propagating in the X and the electric wave between Y,Z.

My ultimate goal is this picture, but animated

enter image description here

Thanks for any help!

| improve this question | | | | |
$\endgroup$
  • $\begingroup$ Can these be a set of points ? You could discretize it and then make a line out of them according to what you are wanting. $\endgroup$ – CA Trevillian Dec 16 '19 at 19:20
  • $\begingroup$ Also, welcome to mma.SE! Check out our Code of Conduct. This is a great question, but I would like to make some edits to show you better syntax to use (using SetDelayed versus Set, for example). I'm working to answer it, but I do not think that your graphic properly represents what you want to show? $\endgroup$ – CA Trevillian Dec 16 '19 at 19:40
  • 2
    $\begingroup$ Duplicate: mathematica.stackexchange.com/questions/211451/… $\endgroup$ – Michael E2 Dec 16 '19 at 23:59
  • $\begingroup$ @MichaelE2 that is an actual duplicate, wow! chaelim should merge the two if they can, perhaps? $\endgroup$ – CA Trevillian Dec 17 '19 at 4:24
9
$\begingroup$
ClearAll[f1, f2]
f1[t_] := Sin[t];
f2[t_] := Sin[3 t];

Animate[ParametricPlot3D[{{t, f1[t], 0}, {t, 0, f2[t]}, {t, 0, 0}}, {t, 0, tmax},  
  PlotStyle -> {Red, Green, Gray}, 
  PlotRange -> {{0, 3 Pi}, {-1, 1}, {-1, 1}}, 
  ViewPoint -> {2.5, -1.3, 2}], {tmax, .1, 3 Pi}]

enter image description here

frames = Table[ParametricPlot3D[{{t, f1[t], 0}, {t, 0, f2[t]}, {t, 0, 0}}, {t, 0, tmax},  
    PlotStyle -> {Red, Green, Gray}, 
    PlotRange -> {{0, 3 Pi}, {-1, 1}, {-1, 1}}, 
    ViewPoint -> {2.5, -1.3, 2}], {tmax, .1, 3 Pi, 3 Pi/100}];

Export["anim.gif", frames]

enter image description here

You can embellish the content styling the lines as tubes and showing additional elements:

ClearAll[show]
show[tm_] := Show[ParametricPlot3D[{{t, f1[t], 0}, {t, 0, f2[t]}}, {t, 0, tm},  
   PlotStyle -> {Directive[Red, Tube[.05]], 
     Directive[Green, Tube[.05]]}, PlotRangePadding -> Scaled[.03], 
   PlotRange -> {{0, 3 Pi}, {-1, 1}, {-1, 1}}, 
   ViewPoint -> {2.5, -1.3, 2}], 
  Graphics3D[{ Opacity[.2, Red], EdgeForm[], 
    InfinitePlane[{0, 0, 0}, {{1, 0, 0}, {1, 1, 0}}], Green, 
    InfinitePlane[{0, 0, 0}, {{1, 0, 0}, {1, 0, 1}}] , Opacity[1], 
    Black, Thin, InfiniteLine[{{0, 0, 0}, {3 Pi, 0, 0}}]}]]

Animate[show[tmax], {tmax, .1, 3 Pi}]

enter image description here

frames = Table[show[tmax], {tmax, .1, 3 Pi, 3 Pi/100}];
Export["anim.gif", frames]

enter image description here

| improve this answer | | | | |
$\endgroup$
  • 1
    $\begingroup$ Nice one! OP's plot specifications are a little weird (to me) I can't parse out what is time and what is whatever else. I hope they can answer, else this is a good method to follow, @chae-lim $\endgroup$ – CA Trevillian Dec 16 '19 at 19:59
  • $\begingroup$ Hey! Thank for this! Another quick question if you don't mind answering: If you see my electric field and magnetic fields? they have very small values. When I plug my wave functions into the code you've showed me, the wave is not even visible. I can change the range of the graph, but I am not able to change the Zoom. I was wondering if there was a function for that? $\endgroup$ – chae lim Dec 16 '19 at 20:24
  • 2
    $\begingroup$ @chaelim, try changing PlotRange -> {{0, 3 Pi}, {-1, 1}, {-1, 1}} to PlotRange -> {{0, 3 Pi}, All, All}. $\endgroup$ – kglr Dec 16 '19 at 20:37
  • 3
    $\begingroup$ The usual way to handle this is to change units---multiply all equalities by 4πε and plot (4πεE) against time. $\endgroup$ – evanb Dec 16 '19 at 20:38
  • 1
    $\begingroup$ Thank you both! I got it working. $\endgroup$ – chae lim Dec 16 '19 at 20:47

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.