3D EM plot using plot3

8 ビュー (過去 30 日間)
Phil P
Phil P 2019 年 12 月 4 日
コメント済み: darova 2019 年 12 月 5 日
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 件のコメント
Phil P
Phil P 2019 年 12 月 5 日
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 2019 年 12 月 5 日
  • "Plot the two components of the electromagnetic wave at t=0 for region 0 < x < 12 cm"
Your code is correct for this condition

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by