3d 中的 Matlab 2d 等高线图

Matlab 2d contour plot in 3d

我想在 3d 中绘制 2d 等高线图 space 但它不应该在 XY 平面上,而应该在 ZX 平面上。有没有办法改变绘制它的平面?

这里是一些例子:

figure;
contourf(ZZ1,YZ1,EH);

hold all;

line([0 0],[0 0],[0 1]);
view(25,20);

输出:

我想要面向我的平面上的等值线图!

这只是关于如何使用 contourslice:

的粗略概念
p = peaks(21);
contourf(p);
view(25,20);

插入您的数据而不是 peaks(21) 并注意尺寸。 然后你可以做一些像

%Get a grid for your data. x and z have dimensions of your old data grid,
%y will is used to build a volume, which will have three slices with the
%data, which is necessary because contourslice takes a volume, not a surface
x = -2:0.2:2;
y = -0.1:0.1:0.1;
z = -2:0.2:2;
[X,Y,Z] = meshgrid(x,y,z);
%Make your data matrix (which is 2D so far) 3D by repeating 3 times in Z
u = repmat(p, [1, 1, 3]);
Sx = []; %No planes to be drawn orthogonal to X
Sy = 0;  %One plane to be drawn orthogonal to Y
Sz = []; %No planes to be drawn orthogonal to Z
%Only draw one of your three y planes. Change X and Z.
figure;
contourslice(X,Y,Z,permute(u,[3, 2, 1]),Sx,Sy,Sz)
view(25,20);

获得