Question
Problem 3: Please solve using matlab Do a 3D surface function. You can make a sphere, cylinder, cone - or a sheet. You may not
Problem 3: Please solve using matlab
Do a 3D surface function. You can make a sphere, cylinder, cone - or a sheet. You may not call sphere/cylinder for this problem.
Extra credit:
Do a super quadric instead: https://en.wikipedia.org/wiki/Superquadrics
Deliverables:
1. Function to map s,t to x,y,z (in a function file)
2. Script to create grid of points, call surface, and plot surface
3. Picture of your surface
Step by Step Instructions:
1. Create a function file that takes in u,v and returns X,Y,Z
a) Sphere/cylinder/cone: Use the equation (google it)
b) Sheet: I did the equation below; but you can make up your own
..... X = u2
..... Y = v2 + u
..... Z = 1/(uv + 3)
2. Use meshgrid to create your U,V 2D array of u,v values
a) Sphere/cylinder/cone: usually has one of u,v going from -pi to pi, the other going from -pi/2 to pi/2 (or sometimes 0 to pi). Make sure the grid is the right-way round
..... If you get half a sphere or a double sphere you may need to swap u and v
b) Sheet: I did -1 to 1 for u, -2 to 2 for v
3. Call your function with your U and V 2D arrays
4. Plot using surf
5. Extra credit:
a) This would be a really good time to use a struct to carry around the parameters for your superquadric
b) You will need two auxiliary functions, f and g, in addition to the main function
..... You will need the function sign(x) to write f and g
c) If A = B = C = 1,and r = s = t = 2 then you get a sphere. See comment above about u and v in meshgrid above if you are, eg, getting half a surface
d) Title your plot with your ABC and rst values
Self-check: Sphere or sheet
ADG 1.010 L0 rat 202020 Example extra credit 8o
Step 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