The torus is a surface of revolution generated by revolving a circle in three-di
ID: 3835120 • Letter: T
Question
The torus is a surface of revolution generated by revolving a circle in three-dimensional space about an axis coplanar with the circle. If the revolution radius is equal to zero then than means the circle just revolves around its own axis and therefore, creates a sphere. If the axis of revolution is greater than 0, then a torus begins forming. If the axis of revolution is larger than the circle's radius, then you start to create a hole in the middle. Use the following code to see the progression. Your job is to create a plot with four subplots: each of the subplot contains the plot below with a different value of c, when c=0, c = 1, c = 1.5, c = 2. You must use a for loop to create your plot!!! (This only requires you adding four lines of code or less!! - Do not copy and paste this code four times!). a=1; %minor radius c=0; %major radius [u, v]=meshgrid(0:2*pi/100:2*pi); x= (c + a*cos(v)).*cos(u); y= (c + a*cos(v)).*sin(u); z=a*sin(v); surfl(x, y, z) axis equal;Explanation / Answer
%CODE
i = 0; %indicates the position in subplot
for c = [0 1 1.5 2] %different values of c or major axis
i = i + 1; %update plot location
a=1; %minor radius
[u,v]=meshgrid(0:2*pi/100:2*pi);
x=(c+a*cos(v)).*cos(u);
y=(c+a*cos(v)).*sin(u);
z=a*sin(v);
subplot(2, 2, i); %plot at different plot location
surfl(x,y,z)
axis equal;
end
%CODE END
I tried my best to keep the code as simple as possible. The lines i have added are already commented to help you. If you are still having any doubt, pleae feel free to comment below. I shall ty my best to resolve all your queries!
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.