# How can I plot y-z plane slices in a 3D volume?

조회 수: 93 (최근 30일)
Nathan Lauer . 2016년 5월 3일
댓글: Josh . 2020년 12월 11일
I have a series of plots representing the vorticity field behind an aircraft wing, at various downstream distances. Each is a 2D plot, and I would like to display them in 3D, one behind the other, in order to get a full 3D sense of the vorticity field behind the wing. In my first attempt, I made a 3D meshgrid, set it to zero, and filled in 4 z-slices with 4 vorticity plots, and that worked. However, I could not get it to the viewpoint that I wanted. Here is the plot that resulted:
This is rather confusing because in this plot, the wing is beneath the plot, and therefore is more likely to confuse the intended audience than do any good. Further, in attempting to change the viewing angle with Matlab's view command, I was not able to get to the desired viewing angle.
So then I made a second attempt, where instead of plotting z-slices I plot x-slices. This does indeed give me the desired viewing angle, as seen here (where the slices are just zeros):
Here, the wing is to the left of the plot, and it's much easier for the audience to get a sense of the full 3D vorticity field. However, I am unable to get the vorticity plots to display. Here is my code:
FullVectorField = zeros(200,14,13);
[x,y,z] = meshgrid(1:1:14, 1:1:200, 1:1:13);
FullVectorField(50,:,:) = vorticity70;
FullVectorField(100,:,:) = vorticity80;
FullVectorField(150,:,:) = vorticity90;
FullVectorField(200,:,:) = vorticity100;
zslice = [];
xslice = [50,100,150,200];
yslice = [];
A = FullVectorField(50,:,:);
figure
slice(x,y,z,FullVectorField,xslice,yslice,zslice);
pbaspect([3 1 1])
axis([0, 200, 0, 14, 0, 13])
colormap jet
colorbar
xlabel('x axis (cm)')
ylabel('y axis (cm)')
zlabel('z axis (cm)')
vorticity70, vorticity80, etc are the matrices containing the data points I would like to plot. Any help in getting the vorticity plots to display along the xslices? Thanks!

댓글을 달려면 로그인하십시오.

### 채택된 답변

Mike Garrity 2016년 5월 3일
편집: Mike Garrity 님. 2016년 5월 3일
You don't really need to build a full 3D array and then slice it. You can just place individual 2D slices in a 3D axes.
[y,z] = meshgrid(linspace(0,10,40));
for off=50:50:200
x = off + zeros(size(z));
% My standin for your vorticity data
c = cos((x+y)/5) .* cos((x+z)/5);
surf(x,y,z,c)
hold on
end
hold off
xlim([0 200])
##### 댓글 수: 4이전 댓글 2개 표시이전 댓글 2개 숨기기
hey,
i have the exact problem you just described...do you know how to fix this?
thanks
Josh 2020년 12월 11일

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by