3D EM plot using plot3
조회 수: 8 (최근 30일)
이전 댓글 표시
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
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개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!