How can I sketch correctly?

4 Ansichten (letzte 30 Tage)
Tam Nguyen
Tam Nguyen am 22 Jun. 2020
Kommentiert: Tam Nguyen am 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 Kommentare
darova
darova am 22 Jun. 2020
Have you tried something? What about integral?
Tam Nguyen
Tam Nguyen am 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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

darova
darova am 23 Jun. 2020
Bearbeitet: darova am 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 Kommentar
Tam Nguyen
Tam Nguyen am 25 Jun. 2020
wow, i did not think about that equation, thank you very much

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by