converting 3-d geometric shapes to pde.DiscreteGeometry class

Is that possible to draw 3-d geometric shapes (paraboloid for example) using surf or plot and convert them to pde.DiscreteGeometry class?

Answers (1)

Hi Mohamed,
I understand that you wish to plot 3d geometric shapes using surf or plot and convert to pde.DiscreteGeometry class. Given below is an example code to plot a paraboloid using the surf function.
% create a 3D sphere
[X, Y, Z] = sphere;
% plot the sphere
figure;
surfObj = surf(X, Y, Z);
axis equal;
% Add labels and a title
xlabel('X-axis');
ylabel('Y-axis');
zlabel('Z-axis');
title('3D Sphere');
In respone to your question, you can leverage surf2stl to write STL file from surface data (via passing the "surfObj" to the function). Once you have the STL file, you can use the importGeometry function from the Partial Differential Equations toolbox to create the geometry object.
I hope this helps.

Products

Release

R2023a

Asked:

on 20 Aug 2023

Edited:

on 12 Jan 2024

Community Treasure Hunt

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

Start Hunting!