Cross-sectional area of a cone(ish)
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
jlt199
am 31 Aug. 2016
Beantwortet: jlt199
am 9 Sep. 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?
0 Kommentare
Akzeptierte Antwort
John D'Errico
am 31 Aug. 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 Kommentare
Weitere Antworten (2)
Chad Greene
am 31 Aug. 2016
Bearbeitet: Chad Greene
am 31 Aug. 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 Kommentare
Chad Greene
am 9 Sep. 2016
Hey Sean, the C2xyz function simply converts the difficult-to-interpret C matrix into more intuitive x and y values.
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!