Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PLEASE WRITE IN PYTHON ASAP. THANK YOU !!! Matplotlib Application Write a function cylinder (radius, height) that generates a 3D cylinder using a contour map.
PLEASE WRITE IN PYTHON ASAP. THANK YOU !!!
Matplotlib Application Write a function cylinder (radius, height) that generates a 3D cylinder using a contour map. Your function should work with the following code: The program should produce two cylinders. For simplicity, you can draw a cylinder in one figure (window), so after closing the window, another window with a new figure appears. The first cylinder height is 2 units, and its radius is 1 unit. The second cylinder height is 10 units, and its radius is 2 units. You need to use the NumPy meshgrid method to generate coordinates for the contour map similar to how you did in lab 5. You can check our Google Colab CSE30 Python Abstractions.ipynb - Colaboratory (google.com) G for guidance on how to create a 3D plot. The first cylinder should look like the following picture: Hints: you can calculate x and y coordinates using the following equations: x=radiusnpcos(theta)y=radiusnp.sin(theta) where theta is an angle used as a parameter in the polar coordinate system. For one contour, theta can be calculates as theta =np.linspace(0, 2np.pi, 100). Remember to use a meshgrid to create other contours. Matplotlib Application Write a function cylinder (radius, height) that generates a 3D cylinder using a contour map. Your function should work with the following code: The program should produce two cylinders. For simplicity, you can draw a cylinder in one figure (window), so after closing the window, another window with a new figure appears. The first cylinder height is 2 units, and its radius is 1 unit. The second cylinder height is 10 units, and its radius is 2 units. You need to use the NumPy meshgrid method to generate coordinates for the contour map similar to how you did in lab 5. You can check our Google Colab CSE30 Python Abstractions.ipynb - Colaboratory (google.com) G for guidance on how to create a 3D plot. The first cylinder should look like the following picture: Hints: you can calculate x and y coordinates using the following equations: x=radiusnpcos(theta)y=radiusnp.sin(theta) where theta is an angle used as a parameter in the polar coordinate system. For one contour, theta can be calculates as theta =np.linspace(0, 2np.pi, 100). Remember to use a meshgrid to create other contoursStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started