How can i find inside area of the geometry (2d) ??
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Dr Sohaib Khan
am 20 Jul. 2023
Kommentiert: Dr Sohaib Khan
am 20 Jul. 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
leg1 = cell(length(n1),1);
x2 = zeros(length(t2),length(n2));
y2 = x2;
z2 = x2*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)
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu MATLAB Mobile finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!