Cross-sectional area of a cone(ish)

6 次查看(过去 30 天)
Morning all,
I have a surface that looks something like a lopsided squished cone, hollow in the middle.
I would like to take the cross-sectional area at different heights, but I need some help. I'm sure it shouldn't be too difficult but I can't figure it out today. I can use the countour function to plot the contours at different heights, but not find the area of the cross-section.
Can anyone help me please?

采纳的回答

John D'Errico
John D'Errico 2016-8-31
And polyarea won't suffice to compute the area of a polygon? It should.
Just generate the contours as desired. Then use polyarea. Easy.
  6 个评论
jlt199
jlt199 2016-9-9
Thanks for your help John, I have just got back to this problem after having to leave it to write reports :(
I was as surprised by the level of noise as you, it's only in about 5 of about several hundred surfaces, so I missed it originally.
I'm having a hard time working out the structure of the matrix C which is output from the contour3 function, I have tried looking at the code for contour3, but really didn't understand what was going on. Can anyone help me with this? I would like to isolate polygons as suggested, but I can't understand the data structure.
Another thought I had was to just send the portion of the surface that contains the "horn" to the contour3 function, but I can't think how to do that either.
If anyone can help with either of these two problems I would be very grateful.
This is the surface I am currently working with:
Many thanks
jlt199
jlt199 2016-9-9
Ok, I've figured out the structure of C now. Now I just need to figure out what to do with it...

请先登录,再进行评论。

更多回答(2 个)

Chad Greene
Chad Greene 2016-8-31
编辑:Chad Greene 2016-8-31
I'd use my C2xyz function which is on File Exchange to easily get the x,y values of a contour line. Below I'm using the built-in peaks data as an example dataset and getting the area of the polygon bounded by the z=6 line.
[X,Y,Z] = peaks(1000);
pcolor(X,Y,Z);
shading interp
colorbar
zval = 6;
hold on
C = contour(X,Y,Z,zval*[1 1],'k');
[x,y,z] = C2xyz(C);
A = polyarea(x{1},y{1})
A =
0.6661
  2 个评论
Sean de Wolski
Sean de Wolski 2016-8-31
How is C2xyz different than contourc?
Chad Greene
Chad Greene 2016-9-9
Hey Sean, the C2xyz function simply converts the difficult-to-interpret C matrix into more intuitive x and y values.

请先登录,再进行评论。


jlt199
jlt199 2016-9-9
Thanks, I've managed to get it working in most cases. Except where the noise gets horrendous.
Many thanks for your time

类别

Help CenterFile Exchange 中查找有关 Computational Geometry 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by