how to fix my code and how to find the area of the regon
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Consider the region inside the outer loop but outside the inner loop of the limacon r = 3 - 6 sin theta . produce a complete graph of the limacon and find the area of the region.
syms thet s
y = 3-6*sin(thet )
ezpolar(3-6*sin(thet ) , [ 0 , 2*pi] )
figure
ths = 0 : 0.01 : 2*pi ;
polar(ths , 3-6*sin(ths))
3 Commenti
Image Analyst
il 23 Nov 2015
Is the inner part of the curlicue to be considered as being part of the area or excluded from the area?
Carlos Guerrero García
il 13 Nov 2022
As the statement, the area to calculate is the green one in the following fig:
Risposte (2)
Carlos Guerrero García
il 14 Nov 2022
Spostato: Image Analyst
il 14 Nov 2022
The area is 9*(pi+3sqrt(3))=75.0397..., but I wrote the following script to estimate that value via the Montecarlo method. I know that the code is not the best one, but I was only checking the result obtained by integration (in R2 or using the Green theorem)
function A=limacon(n)
outside=0;
P=[6-12*rand(n,1) 1-10*rand(n,1)]; % Choosing n random points in [-6,6]x[-9,1]
polar=[sqrt(P(:,1).^2+P(:,2).^2) atan2(P(:,2),P(:,1))+2*pi*(atan2(P(:,2),P(:,1))<0)]; % Cartesian coordenates to polar coordinates with Arg in [0,2*pi)
plot(P(:,1),P(:,2),'.','MarkerSize',10); hold on; % Ploting the random points
t=0:pi/100:2*pi; plot((3-6*sin(t)).*cos(t),(3-6*sin(t)).*sin(t),'k','LineWidth',2); % Ploting the limacon
axis([-7 7 -10 2]); axis equal;
for k=1:n; % Cheking it the point aren't in the limacon: outside the outer loop or in the inner loop
if polar(k,2)<=pi/6 && polar(k,1)>=3-6*sin(polar(k,2))
outside=outside+1;
elseif polar(k,2)>pi/6 && polar(k,2)<=5*pi/6
outside=outside+1;
elseif polar(k,2)>5*pi/6 && polar(k,2)<=7*pi/6 && polar(k,1)>=3-6*sin(polar(k,2))
outside=outside+1;
elseif polar(k,2)>7*pi/6 && polar(k,2)<=11*pi/6 && polar(k,1)>=3-6*sin(polar(k,2))
outside=outside+1;
elseif polar(k,2)>7*pi/6 && polar(k,2)<=11*pi/6 && polar(k,1)<=-6*sin(polar(k,2))-3
outside=outside+1;
elseif polar(k,2)>11*pi/6 && polar(k,1)>=3-6*sin(polar(k,2))
outside=outside+1;
end
end
A=120*(n-outside)/n; % Calculating the ratio and estimating the area
0 Commenti
Carlos Guerrero García
il 15 Nov 2022
Modificato: Carlos Guerrero García
il 15 Nov 2022
The area can be found as follows (the explanation can be found in any Calculus text. I think that here is not the right place for an extended document about. Also I don't know if you want the value, the explanation, the code, ...or all of them. If you don't find the reason of that equality in your favorite Calculus text, I don't have any problem to send an extended document with the equality):
syms t;
A=int((3-6*sin(t))^2,t,5*pi/6,13*pi/6)/2-int((3-6*sin(t))^2,t,13*pi/6,17*pi/6)/2
0 Commenti
Vedere anche
Categorie
Scopri di più su Matrix Computations in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!