将结果视图角度调整为xo面:x = linspace(-5,5,100);z = linspace(-5,5,100);[X,Z] = meshgrid(x,z);k = 2*pi/lambda;w = 2*pi*f;E_0 = 1;theta = pi/2;figure();axis([-5,5,-5,5,-5,5]);for i = 1:length(t) E_z = -2*E_0*sin(k*cos(theta)*Z).*sin(w*t(i)-k*sin(theta)*X); surf(X,E_z,Z); xlabel('x(m)'); ylabel('y(m)'); zlabel('z(m)'); title(sprintf('时间:%.2fs',t(i))); drawnow;end
时间: 2024-02-22 20:00:44 浏览: 107
dsb.rar_DSB-SC 模拟调制_onea55_recognize5fu
将结果视图角度调整为 $x$-$z$ 平面,只需要将视角旋转即可。修改后的代码如下:
```
x = linspace(-5,5,100);
z = linspace(-5,5,100);
[X,Z] = meshgrid(x,z);
k = 2*pi/lambda;
w = 2*pi*f;
E_0 = 1;
theta = pi/2;
figure();
axis([-5,5,-5,5,-5,5]);
for i = 1:length(t)
E_z = -2*E_0*sin(k*cos(theta)*Z).*sin(w*t(i)-k*sin(theta)*X);
surf(X,E_z,Z);
xlabel('x(m)');
ylabel('y(m)');
zlabel('z(m)');
title(sprintf('时间:%.2fs',t(i)));
view(0,90); % 将视角旋转为 x-z 平面
drawnow;
end
```
其中,view(0,90) 表示将视角旋转为 x-z 平面,即俯视视角。
阅读全文