我想绘制二维矢量的振幅和方向如何随时间演变。为此,我想创建一个让人想起规范的 E 和 B 场图的图,您可能还记得电学和磁学入门课上的这些图。
具体来说,我想用丝带连接我的 2D 矢量点,以便于查看。在 MATLAB 中有一种简单的方法可以做到这一点吗? quiver3
非常接近,但缺少功能区。也许某种参数曲面?
最佳答案
您可以使用绘图函数 FILL3和 QUIVER3做这样的事情:
x = linspace(0,4*pi,30); %# Create some x data
y1 = sin(x); %# Create wave 1
y2 = sin(x-pi); %# Create wave 2
u = zeros(size(x)); %# Create a vector of zeroes
hRibbon1 = fill3(x,y1,u,'r'); %# Plot wave 1 and fill underneath with color
set(hRibbon1,'EdgeColor','r',... %# Change the edge color and
'FaceAlpha',0.5); %# make the colored patch transparent
hold on; %# Add to the existing plot
quiver3(x,u,u,u,y1,u,0,'r'); %# Plot the arrows
hRibbon2 = fill3(x,u,y2,'b'); %# Plot wave 2 and fill underneath with color
set(hRibbon2,'EdgeColor','b',... %# Change the edge color and
'FaceAlpha',0.5); %# make the colored patch transparent
quiver3(x,u,u,u,u,y2,0,'b'); %# Plot the arrows
axis equal; %# Use equal axis scaling
这是结果图:
关于math - 在 MATLAB 中将 3D 中的 2D 矢量演变绘制为色带,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3979172/