This code may help, instead of using pol2cart
instruction, you can use your own equations, the resultant shape depends on the range specified in meshgrid
at beginning, also I added Rotation option, of course you can comment that to ignore that option if you do like.
%===========================
% Close and Clear
%===========================
clc
close all
clear all
%===========================
% making a cylinder
%===========================
[theta, r, h] = meshgrid(0:.1:6.28,0:0.1:1, 0:.2:4);
%====================================
% transforming the coordinate system
%====================================
[x, y, z] = pol2cart(theta, r, h);
%====================================================
% rotating the data points around x axis by 60 degree
%====================================================
P = (rotx(60) * [x(:), y(:), z(:)]')';
%P = [x(:), y(:), z(:)];
%=======================================
%=======================================
% Drawing The Cloud Points
%=======================================
figure('Name','Cylinder Point Cloud','NumberTitle','off');
scatter3(P(:, 1), P(:, 2), P(:, 3)); % plots a circles around sample points
title('Cylinder Point Cloud');
axis equal
%===============================================