How can I sketch correctly?

2 views (last 30 days)
Tam Nguyen
Tam Nguyen on 22 Jun 2020
Commented: Tam Nguyen on 25 Jun 2020
I got this question:
Evaluate the volume V of the solid Ω that lies under the paraboloid z = x^2+y^2 , and above the circular region in the xy−plane x^2 + y^2 = 2x. Sketch the given solid.
This is what I have done, I do not know how to erase the extra part so that I can get the solid satisfying the question. Can anyone help me solving this issue?
Thank you for reading.
%Calculation
syms r phi
func = r.^3;
rmax = 2.*cos(phi);
result = int(int(func, 0, rmax), 0, 2*pi);
disp('Result: '), disp(result);
%draw the paraboloid
phi = linspace (0, 2*pi, 30);
r = linspace(0, 2, 30);
[r, p] = meshgrid(r, phi);
x = r.*cos(p);
y = r.*sin(p);
z = x.^2 + y.^2;
surf(x, y, z, 'FaceColor', 'g', 'FaceAlpha', 0.3);
hold on
%draw the cylinder
x1 = linspace(0, 2, 500);
z1 = linspace(0, 4, 500);
[x1,z1] = meshgrid(x1,z1);
y1 = sqrt(-x1.^2 + 2.*x1);
y2 = -sqrt(-x1.^2 + 2.*x1);
surf(x1, real(y1), z1,'FaceColor','b','FaceAlpha',0.5,'EdgeColor','none'); %real for drawing complex number
hold on;
surf(x1, real(y2), z1,'FaceColor','b','FaceAlpha',0.5,'EdgeColor','none');
hold on;
xlabel('x');
ylabel('y');
zlabel('z');
rotate3d on
  2 Comments
darova
darova on 22 Jun 2020
Have you tried something? What about integral?
Tam Nguyen
Tam Nguyen on 22 Jun 2020
well, my teacher did not teach me about how to use integral for drawing so I apply my basic knowledge about Matlab to solve this question.

Sign in to comment.

Accepted Answer

darova
darova on 23 Jun 2020
Edited: darova on 23 Jun 2020
Here is a start
  • try this line to draw the part you are interested in
z1 = (x/2+1).^2 + y.^2/4;
surface(x/2+1, y/2, z1, 'FaceColor', 'r');
DOes it look familiar to you?
  1 Comment
Tam Nguyen
Tam Nguyen on 25 Jun 2020
wow, i did not think about that equation, thank you very much

Sign in to comment.

More Answers (0)

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!