math - 在 MATLAB 中将 3D 中的 2D 矢量演变绘制为色带

标签 math matlab graph plot

我想绘制二维矢量的振幅和方向如何随时间演变。为此,我想创建一个让人想起规范的 E 和 B 场图的图,您可能还记得电学和磁学入门课上的这些图。

具体来说,我想用丝带连接我的 2D 矢量点,以便于查看。在 MATLAB 中有一种简单的方法可以做到这一点吗? quiver3 非常接近,但缺少功能区。也许某种参数曲面?

最佳答案

您可以使用绘图函数 FILL3QUIVER3做这样的事情:

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

这是结果图:

alt text

关于math - 在 MATLAB 中将 3D 中的 2D 矢量演变绘制为色带,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3979172/

相关文章:

matlab - matlab中有什么办法让鼠标粘在曲线上吗?

graph - PAM 和 Metis 分区之间的差异

可视化 100k 顶点和 1M 边的 Python 工具?

c++ - 不使用 sqrt 函数求平方根?

algorithm - 具有某些约束的给定范围内所有数字的总和

python - 将正态分布转换为 softmax

r - 如何更改 ggplot 中的标签(图例)?

python - 将元胞数组(.mat 文件)加载到 Python 中

matlab - 将大文本文件导入 matlab(包括注释;textscan)

c - 程序知道图中从 1 到 n 的所有可能路径