Effacer les filtres
Effacer les filtres

How to calculate the area between X-Axis, Y-Axis and the (60) contour line?

1 vue (au cours des 30 derniers jours)
ly
ly le 24 Jan 2024
Modifié(e) : Matt J le 24 Jan 2024
How to calculate the area between X-Axis, Y-Axis and the (60) contour line?
Code of the contour line:
x = 1:0.2:2;
y = 1:0.2:3;
[X,Y] = meshgrid(x,y);
Z = 1000*(X.*exp(-X.^2-Y.^2));
contour(X,Y,Z,[20 60 80],'ShowText','on')

Réponse acceptée

Matt J
Matt J le 24 Jan 2024
Modifié(e) : Matt J le 24 Jan 2024
Using this FEX download,
x = 1:0.2:2;
y = 1:0.2:3;
[X,Y] = meshgrid(x,y);
Z = 1000*(X.*exp(-X.^2-Y.^2));
cm=contour(X,Y,Z,[20 60 80],'ShowText','on');
[~, V]=getContourLineCoordinates(cm);
p=polyshape([1,1; V{2}]);
hold on;
plot(p);
hold off
Area=area(p)
Area = 0.1006

Plus de réponses (0)

Catégories

En savoir plus sur Contour Plots dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by