How can I plot y-z plane slices in a 3D volume?
조회 수: 93 (최근 30일)
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,:,:);
pbaspect([3 1 1])
axis([0, 200, 0, 14, 0, 13])
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));
x = off + zeros(size(z));
% My standin for your vorticity data
c = cos((x+y)/5) .* cos((x+z)/5);