필터 지우기
필터 지우기

Cross-sectional area of a cone(ish)

조회 수: 3 (최근 30일)
jlt199
jlt199 2016년 8월 31일
답변: jlt199 2016년 9월 9일
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