Borrar filtros
Borrar filtros

Draw contour data on slice with a patch

2 visualizaciones (últimos 30 días)
Nathaniel H Werner
Nathaniel H Werner el 2 de Oct. de 2018
Editada: Nathaniel H Werner el 2 de Oct. de 2018
I'm having trouble making a contour of my volume data on a plane with specified coordinates designed for patch.
I have 5 slices I am looking to make along the span of a wing.
% set of plane coordinates for wing
xp = [0.2415 -4.0886 -4.5716 -0.2415];
yp = [0.1294 0.1294 -0.1294 -0.1294];
zp = [-0.4183 -2.9183 -2.0817 0.4183];
figure
patch(xp,yp,zp,'g') % draw wing
hold on
% I guess if you want to try running this replace Xw Yw Zw with -4:0.2:4 and Slice_var with flow or something
for i=1:length(spx1)
h = slice(Xw,Yw,Zw,Slice_var,...
[spx1(i) spx1(i) spx2(i) spx2(i)],...
[yp(4) yp(1)+1 yp(1)+1 yp(4)],...
[spz1(i) spz1(i) spz2(i) spz2(i)]);
set(h,'edgecolor','none')
end
figure
patch(xp,yp,zp,'g') % draw wing
hold on
% slice planes
spx1 = xp(1):(xp(2)-xp(1))/5:xp(2); spx2 = xp(4):(xp(3)-xp(4))/5:xp(3);
spz1 = zp(1):(zp(2)-zp(1))/5:zp(2); spz2 = zp(4):(zp(3)-zp(4))/5:zp(3);
for i=1:length(spx1)
patch([spx1(i) spx1(i) spx2(i) spx2(i)],...
[yp(4) yp(1)+1 yp(1)+1 yp(4)],...
[spz1(i) spz1(i) spz2(i) spz2(i)],'b');
end
When I try to make my contour plots, instead of making 5 slices along the span I get slices in the xy, yz, and xz planes. I would like to have my contours on these blue slices in the second image.

Respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by