How can I sketch correctly?

7 ビュー (過去 30 日間)
Tam Nguyen
Tam Nguyen 2020 年 6 月 22 日
コメント済み: Tam Nguyen 2020 年 6 月 25 日
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 件のコメント
darova
darova 2020 年 6 月 22 日
Have you tried something? What about integral?
Tam Nguyen
Tam Nguyen 2020 年 6 月 22 日
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.

サインインしてコメントする。

採用された回答

darova
darova 2020 年 6 月 23 日
編集済み: darova 2020 年 6 月 23 日
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 件のコメント
Tam Nguyen
Tam Nguyen 2020 年 6 月 25 日
wow, i did not think about that equation, thank you very much

サインインしてコメントする。

その他の回答 (0 件)

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by