Cross-sectional area of a cone(ish)

4 visualizaciones (últimos 30 días)
jlt199
jlt199 el 31 de Ag. de 2016
Respondida: jlt199 el 9 de Sept. de 2016
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?

Respuesta aceptada

John D'Errico
John D'Errico el 31 de Ag. de 2016
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 comentarios
jlt199
jlt199 el 9 de Sept. de 2016
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 el 9 de Sept. de 2016
Ok, I've figured out the structure of C now. Now I just need to figure out what to do with it...

Iniciar sesión para comentar.

Más respuestas (2)

Chad Greene
Chad Greene el 31 de Ag. de 2016
Editada: Chad Greene el 31 de Ag. de 2016
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 comentarios
Sean de Wolski
Sean de Wolski el 31 de Ag. de 2016
How is C2xyz different than contourc?
Chad Greene
Chad Greene el 9 de Sept. de 2016
Hey Sean, the C2xyz function simply converts the difficult-to-interpret C matrix into more intuitive x and y values.

Iniciar sesión para comentar.


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

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by