How do I create an abstract smooth 3-D shape using known points?
Mostrar comentarios más antiguos
I used the data points below and created triangular surfaces by using scatter3, and fill3. This creates the image attached but I wanted a smoother shape that isn't created by smaller peices. Is there a way to create the same shape in a non-piecewise method to produce a smooth abstract shape? This shape has symmetry so I used that to my advantage. I tried to use the surf function but it doesn't look right.
sigma1c = [18 19 22.3 24.5 25.4 28.7 31.2 33.3 34.4 35.2];
sigma2c = [.7 1.3 2.5 3.9 5 10 15 20 23 27];
sigma3c = [.7 1.3 2.5 3.9 5 10 15 20 23 27];
sigma1e = [16 18 19.5 20 21.8 24 30 35 38 45.2];
sigma2e = [16 18 19.5 20 21.8 24 30 35 38 45.2];
sigma3e = [0.1 0.3 1.2 1.2 2.7 2.6 4.9 11 14.1 30];
2 comentarios
Hayley Kieu
el 10 de Abr. de 2024
The figure —
F = openfig('A23DBothOpen.fig');
F.Visible = 1;
Respuestas (1)
Ayush Anand
el 10 de Abr. de 2024
Hi,
"surf" requires the data passed to form a grid for a smooth plot. If the data does not naturally form a grid, one common approach is to use "meshgrid" in combination with "griddata" for interpolation of the data points. This method works by creating a grid that covers the range of your data and then interpolating the values of your data onto this grid. The interpolated grid can then be used with "surf" to create a smooth surface. You can try this as the following:
% sigma1 = ...
% sigma2 = ...
% sigma3 = ...
% Create a dense grid over your data range
[xq, yq] = meshgrid(linspace(min(sigma1), max(sigma1), 100), ...
linspace(min(sigma2), max(sigma2), 100));
% Interpolate to get z values on the grid
% Using linear interpolation here, but can also consider 'cubic' or 'v4' for smoother results
zq = griddata(sigma1, sigma2, sigma3, xq, yq, 'linear');
% Plot the surface
figure;
surf(xq, yq, zq, 'EdgeColor', 'none'); % 'none' removes gridlines for a smoother appearance
xlabel('\sigma_1');
ylabel('\sigma_2');
zlabel('\sigma_3');
You can read more about "meshgrid" and "griddata" here:
- https://in.mathworks.com/help/matlab/ref/meshgrid.html (Official documentation page of the "meshgrid" function)
- https://in.mathworks.com/help/matlab/ref/griddata.html (Official documentation page of the "griddata" function)
Hope this helps!
Categorías
Más información sobre Graphics Performance en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
