Question
Using the below code, i have geneated sphere. could anyone please guide me how to geneate cone using random scattered point cloud. I will be very thankful. Thanks in advance to all community members for their cooperation and guidance. Regards r = randn (10000,3); r = round(bsxfun(@rdivide,r,sqrt(sum(r.^2,2)))*130); x = r(:,1); y = r(:,2); z = r(:,3); scatter3(x,y,z)
Expert Answer
John Williams
PhD Expert
Answered Aug 13, 2026
This code provides the uniform distribution on the surface of the cone
h = 3; % height
r = 1; % base radius
n = 1e4; % number of points
topcapflag = true; % include the top cap or not
rho = sqrt(rand(1,n));
z = h*rho;
if topcapflag
z(rand(1,n)<r/(h+r))=h;
end
theta = (2*pi)*rand(1,n);
rho = r*rho;
x = cos(theta).*rho;
y = sin(theta).*rho;
% graphic check
figure
plot3(x,y,z,'.')
axis equal
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related matlab Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →