如何修复 streamslice 和 imagesc 图之间的轴不匹配?

How to fix axis mismatch between streamslice and imagesc plot?

我正在尝试在 vz, velocity along zimagesc 之上绘制数据集的流线 (vx, vy), velocity along x and y。数据集和流线图显示在这个 MWE 中:

x=[0    0.0125    0.0250    0.0375    0.0500,
     0    0.0125    0.0250    0.0375    0.0500,
     0    0.0125    0.0250    0.0375    0.0500,
     0    0.0125    0.0250    0.0375    0.0500,
     0    0.0125    0.0250    0.0375    0.0500];

 y=[0         0         0         0         0,
0.0125    0.0125    0.0125    0.0125    0.0125,
0.0250    0.0250    0.0250    0.0250    0.0250,
0.0375    0.0375    0.0375    0.0375    0.0375,
0.0500    0.0500    0.0500    0.0500    0.0500];

vx=[0.0009   -0.0019   -0.0058   -0.0040   -0.0028,
0.0012    0.0159    0.1207    0.1465    0.0985,
0.0007    0.0018   -0.0367    0.2432   -0.0053,
0.0004    0.0920    0.1796    0.3807    0.0338,
-0.0006    0.1708    0.1764    0.2567    0.1256];

vy=[0.0002    0.0000   -0.0001   -0.0001   -0.0001,
-0.0003   -0.0156   -0.0076   -0.0251   -0.0433,
-0.0008   -0.0113   -0.0218   -0.0519   -0.0720,
-0.0006   -0.0091   -0.0326   -0.0778   -0.1087,
-0.0003   -0.0026   -0.0025   -0.0416   -0.1048];


vz=[0.0002    0.0000   -0.0001   -0.0001   -0.0001,
-0.0003   -0.0156   -0.0076   -0.0251   -0.0433,
-0.0008   -0.0113   -0.0218   -0.0519   -0.0720,
-0.0006   -0.0091   -0.0326   -0.0778   -0.1087,
-0.0003   -0.0026   -0.0025   -0.0416   -0.1048];

close all
clc


figure(1)
imagesc([0 0.05], [0 0.05], vx)
colorbar

figure(2)
imagesc([0 0.05], [0 0.05], vy)
colorbar

figure(3)
streamslice(x, y, vx, vy)

但是,当我检查图 3 并将其与图 1 和图 2 进行比较时,显然有些地方不对劲。在 imagesc 中,轴基本上是 x 垂直向下,y 指向右侧,但在流线型中,轴像往常一样,y 向上,x向右。有没有办法将流线轴与 imagesc 的流线轴相匹配,以便我可以合并成两个图?

你实际上不想使用上面的 imagesc, because you don't have pixels. You're looking for surf with view:

figure(1)
surf(x,y,vx)
view(0,90)
colorbar

figure(2)
surf(x,y,vy),
view(0,90)
colorbar

figure(3)
streamslice(x, y, vx, vy)

也许需要一些矩阵转置或视角转换才能使一切变得完美。