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!