% Define the radius and height of the cylinderr = 1; % radiush = 2; % height% Generate the set of points for the cylindertheta = linspace(0, 2*pi, 100); % points for the circumferencez = linspace(0, h, 10); % points along the heighttheta = repmat(theta, [numel(z), 1]); % replicate theta for each heightx = r * cos(theta); % x-coordinatesy = r * sin(theta); % y-coordinatesz = repmat(z', [1, numel(theta)]); % replicate z for each point around the circumference% Create figure and plot the cylinderfigure;
surf(x, y, z);
% Set plot propertiesaxis equal;
xlabel('X');
ylabel('Y');
zlabel('Z');
title('Cylinder under an angle');