Effacer les filtres
Effacer les filtres

3D EM plot using plot3

6 vues (au cours des 30 derniers jours)
Phil P
Phil P le 4 Déc 2019
Commenté : darova le 5 Déc 2019
I got this question and I can't understand if I'm getting the correct plot given the specifications I have.
"Make a 3D plot of the electromagnetic wave at t = 0 for region 0 < x < 12cm. Show simultaneously the electric and magnetic components in one plot. You will need to us vectors of zeros and the plot3 command."
E(x,t) = E0*sin(omega*t - beta*x) in the y direction
H(x,t) = H0*sin(omega*t - beta*x) in the z direction
lambda = 4e-2 m
f = 15 Ghz
t = 0;
0 < x < 0.12 m
This is the code I developed so far
x = linspace(0,0.12,100)
m = zeros(1,100)
t = 0
phi = 0
la = 4e-2
f = 15e9
w = 2*pi*f
b = 2*pi/la
y = sin(w*t -b*x + phi) %Ele wave
z = cos(w*t -b*x + phi) %Mag wave
plot3(x,m,z) %mag field
hold on
plot3(x,y,m) %ele field
hold on
plot3(x,m,m)
hold off
I also got another similar question asking me the following:
"Plot the two components of the electromagnetic wave at t=0 for region 0 < x < 12 cm"
And I actually developed the code above as an answer. Should I instead use separate plots for this question instead of a 3D one?
  5 commentaires
Phil P
Phil P le 5 Déc 2019
This is exactly the thing I don't get from the text. Should it just be a 3D plot of the two waves together or something else? Because this is already a 3D plot.TMA3_Q3C.jpg
How do you use surf in this case?
darova
darova le 5 Déc 2019
  • "Plot the two components of the electromagnetic wave at t=0 for region 0 < x < 12 cm"
Your code is correct for this condition

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by