2
$\begingroup$

I have some experimental data points of electric Ey(t, value) and magnetic field Hz(t, value). I am trying to calculate the cross product of

CrossProduct[Last /@ Ey, Last /@ Hz]

After that, I tried to plot by

ListPlot[Transpose[{First /@ Ey, Last /@ Ey, Last /@ Hz}], Joined -> True].

But it's not working.

Ey(t,value)={{545136.47, -10299.3}, {545272.75, 12749.9}, {545136.47, -10299.3}, 
  {545272.75, 12749.9}, {545409.04, 
  34182.2}, {545545.32, 52240.2}, {545681.61, 
  65501.5}, {545817.89, 72989.9}, {545954.18, 
  74243.1}, {546090.46, 69331.9}, {546226.74, 
  58833.2}, {546363.03, 43760.6}, {546499.31, 25462.}}

 Hz(t,value)= {{435000.19, -28.325425}, {545136.47, 
 32.645681}, {545272.75, 89.460979}, {545409.04, 
 137.48363}, {545545.32, 172.95153}, {545681.61, 
 193.26996}, {545817.89, 197.18915}, {545954.18, 
 184.85647}, {546090.46, 157.74581}, {546226.74, 
 118.47856}, {546363.03, 70.558464}}
$\endgroup$
1
  • $\begingroup$ It looks like some t values in Ey do not exist in Bz and vice-versa, this may contribute some issues you have yet to encounter. $\endgroup$ Commented Nov 16, 2020 at 13:33

1 Answer 1

0
$\begingroup$

First, Ey has at the beginning and the end one data point more than Hz. Eliminate these:

Ey = {{545136.47, -10299.3}, {545272.75, 
    12749.9}, {545136.47, -10299.3}, {545272.75, 12749.9}, {545409.04,
     34182.2}, {545545.32, 52240.2}, {545681.61, 65501.5}, {545817.89,
     72989.9}, {545954.18, 74243.1}, {546090.46, 69331.9}, {546226.74,
     58833.2}, {546363.03, 43760.6}, {546499.31, 25462.}};
Ey = Ey[[2 ;; -2]];

Hz = {{435000.19, -28.325425}, {545136.47, 32.645681}, {545272.75, 
    89.460979}, {545409.04, 137.48363}, {545545.32, 
    172.95153}, {545681.61, 193.26996}, {545817.89, 
    197.18915}, {545954.18, 184.85647}, {546090.46, 
    157.74581}, {546226.74, 118.47856}, {546363.03, 70.558464}}; 

Then you can calculate the cross products:

MapThread[ Cross[{0, #1, 0}, {0, 0, #2}] &, {Ey[[All, 2]], Hz[[All, 2]]}]
(*{{-361146., 0., 0.}, {-336228., 0., 0.}, {1.14062*10^6, 0., 
  0.}, {4.69949*10^6, 0., 0.}, {9.03502*10^6, 0., 0.}, {1.26595*10^7, 
  0., 0.}, {1.43928*10^7, 0., 0.}, {1.37243*10^7, 0., 
  0.}, {1.09368*10^7, 0., 0.}, {6.97047*10^6, 0., 0.}, {3.08768*10^6, 
  0., 0.}}*)

And plot E and H:

ListLinePlot[Ey]
ListLinePlot[{Hz}, PlotRange -> All]

enter image description here enter image description here

$\endgroup$
3
  • 1
    $\begingroup$ The times are misaligned, it might be helpful to show OP how to ensure these are aligned. $\endgroup$ Commented Nov 16, 2020 at 13:32
  • $\begingroup$ @Huber, I want to plot the cross product of Ey[[All, 2]], Hz[[All, 2]]}] $\endgroup$ Commented Nov 17, 2020 at 2:53
  • $\begingroup$ Use ListVectorPlot3D or ListSliceVectorPlot3D $\endgroup$ Commented Nov 17, 2020 at 8:29

Your Answer

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

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