Effacer les filtres
Effacer les filtres

How can i find inside area of the geometry (2d) ??

1 vue (au cours des 30 derniers jours)
Dr Sohaib Khan
Dr Sohaib Khan le 20 Juil 2023
Commenté : Dr Sohaib Khan le 20 Juil 2023
Hello everyone... can anyone please help me and educated me. I want to find the area covered inside this 2d geometry ?? Please let me know how to do it. I shall remain thankful. Please see the code attached.
clc
clear all
close all
t1 = 0:pi/100:pi; % Top curve 0 to 180 deg
t2 = -pi:pi/100:0; % Bottom curve 180 to -180 deg
%%% Shape
a1 = 375; % width, x-axis
a2 = 375;
b1 = 457; % height, y-axis
b2 = 78;
%%% Slope
n1 = -1.43;
m1 = 1.25;
n2 = -1.0;
m2 = 1.6;
x1 = zeros(length(t1),length(n1));
y1 = x1;
z1 = x1*0
z1 = 101×1
0 0 0 0 0 0 0 0 0 0
leg1 = cell(length(n1),1);
x2 = zeros(length(t2),length(n2));
y2 = x2;
z2 = x2*0
z2 = 101×1
0 0 0 0 0 0 0 0 0 0
leg2 = cell(length(n2),1);
for i=1:length(n1)
x1(:,i) = sign(cos(t1)).*a1.*abs(cos(t1)).^(2+n1(i));
y1(:,i) = sign(sin(t1)).*b1.*abs(sin(t1)).^(2+m1(i));
leg(i) = {['n1 = ',num2str(n1(i))]};
end
for i=1:length(n2)
x2(:,i) = sign(cos(t2)).*a2.*abs(cos(t2)).^(2+n2(i));
y2(:,i) = sign(sin(t2)).*b2.*abs(sin(t2)).^(2+m2(i));
leg(i) = {['n2 = ',num2str(n2(i))]};
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure(1)
xlabel('X-axis','fontweight','bold','fontsize',10)
ylabel('Y-axis','fontweight','bold','fontsize',10)
zlabel('Z-axis','fontweight','bold','fontsize',10)
plot3(z1,x1,y1,z2,x2,y2,'linewidth',2)

Réponse acceptée

Matt J
Matt J le 20 Juil 2023
Modifié(e) : Matt J le 20 Juil 2023
Area = polyarea([x1;x2],[y1;y2])
  1 commentaire
Dr Sohaib Khan
Dr Sohaib Khan le 20 Juil 2023
Thankyou soooooooooo much Matt. :) :) :)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by