3D image - how to delete some domain
Show older comments
Hello !
I have the question ,
I try to plot the graph , but I don't know how to erase those part of the graph that lies outside my domain , what should I do ?
Thank You !

Answers (1)
The “fimplicit3” function is designed to plot 3-D implicit functions defined by “f(x, y, z) = 0” over specified intervals for “x” , “y”, and “z”. While it does not directly allow for plotting a cylinder between two planes (two functions), similar results can be achieved by using the following code:
r = 3; x0 = 3; y0 = 3;
% Angular range
theta = linspace(0, 2*pi, 100);
% x and y coordinates of the cylinder
x = x0 + r * cos(theta);
y = y0 + r * sin(theta);
% z range
z_min = zeros(size(theta));
z_max = 18 - x - y;
figure;
hold on;
%Plotting between the given limits
surf([x; x], [y; y], [z_min; z_max], 'FaceColor', [1 0.5 0]);
view(60, 20);
grid on;
axis equal;
hold off;
For more details, please consult the documentation for the functions utilized:
Hope this helps!
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!