# How to sketch the given solid and its condition?

14 visualizzazioni (ultimi 30 giorni)
Khang Ngo il 23 Lug 2021
Risposto: DGM il 31 Lug 2021
I have the solid bounded by 2x+z=2 and (x-1)^2 + y^2=z. Please someone help me to sketch the given solid.
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (2)

Shubham Khatri il 31 Lug 2021
Hello,
Please use the following code to plot the two surfaces
z = @(x,y) (x-1)^2 +y^2; % function handle to anonymous function
fsurf(z)
hold on
z = @(x,y) 2-(2*x)^1 +0*y^2; % function handle to anonymous function
fsurf(z)
You can use different functions to plot a surface. Although the surfaces are not meeting in this case, but you can refer to this answer to connect surfaces to create a solid.
Hope it helps
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

DGM il 31 Lug 2021
For simple visualization, it's often sufficient to just truncate the surfaces by setting the excess values to NaN.
% plot domain
x = linspace(-1.1,1.1,100);
y = linspace(-1.1,1.1,100).';
z1 = (x-1).^2 + y.^2;
z2 = 2 - 2*x + 0*y; % the zero term is just there to force expansion
% mask off surfaces beyond enclosed volume
m = z1>z2;
z1(m) = NaN;
z2(m) = NaN;
surf(x,y,z1); hold on
surf(x,y,z2);
axis equal
view(10,30)
camlight
This doesn't result in a perfectly closed volume, since the surfaces are rectangular meshes and they aren't joined at the edge. For a fine mesh, the result is sufficient to visualize the volume and typically satisfy the intent of homework assignments. You may choose to opt for different view/shading settings or a more complicated approach entirely.
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su Surface and Mesh Plots in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by