Draw contourslice on patch surface

9 次查看(过去 30 天)
I am trying to get the XData and YData on a contourslice in matlab. I want this contourline to be on a patch that I have already made in 3D. The patch corresponds to a rectangular plane orthogonal to the -x axis rotated about the y axis from -x by some angle dphi. I have provided some of my code below with images.
AoAd = 45;
Ty = 1/2*cosd(AoAd); % wing position in y
Tz = 1/2*sind(AoAd); % wing position in z
yslice = [Ty, Ty, -Ty, -Ty]+[1/2, 1/2, -1/2, -1/2];
zslice = [-Tz, Tz, Tz, -Tz]+[-1/2, 1/2, 1/2, -1/2];
xslice = -.15;
S = [xslice*ones(size(yslice));
yslice;
zslice];
dphi = 7.5; % degrees
MR = [[cosd(dphi) 0 -sind(dphi) 0];...
[0 1 0 0];...
[sind(dphi) 0 cosd(dphi) 0];...
[0 0 0 1]];
S_prime = MR*[S,[0,0,0]';
[0,0,0,0],1];
x = S_prime(1,1:4);
y = S_prime(2,1:4);
z = S_prime(3,1:4);
figure
hold on
patch(x,y,z,'r')
cc = contourslice(Xw,Yw,Zw,D_ta,z,y,x,[-3,-3],'linear');
Now, I expect the there two be a single iso-line on the red patch. But instead I get several iso-lines that look orthogonal to the red patch. Can I get some help figuring out what I'm doing wrong here.
It seems to me that the smaller region is at least on a parallel plane but I don't know why the others aren't.
Addendum:
I also tried using the XYZ data from patch and this was the result. Still not on the plane, and there are some slices on different planes.
figure
hold on
p = patch(x,y,z,'r');
xp = p.XData;
yp = p.YData;
zp = p.ZData;
cc = contourslice(Xw,Yw,Zw,D_ta,xp,yp,zp,[-3,-3],'linear');
  2 个评论
darova
darova 2019-8-3
Just to clarify: you want to project your data onto red plane?
Nathaniel H Werner
编辑:Nathaniel H Werner 2019-8-3
Yes, I am trying to get a volume slice of the data on the red patch. If you can't run the code try using the built in flow or peaks.

请先登录,再进行评论。

采纳的回答

darova
darova 2019-8-3
Try to refine mesh of your plane
I attached a simple example (help example modified)
Can you attach your data
  16 个评论
darova
darova 2019-8-6
Maybe you wanted slice of XZ plane? I like it more
img2.png img3.png
Nathaniel H Werner
The right image looks exactly like what I need, the red planes are XY or YZ planes rotated around the Y axis. Does the new Untitled3 script make that figure?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by