3D EM plot using plot3

조회 수: 9 (최근 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 CenterFile Exchange에서 2-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