Representation of wall shear stress in 3D

5 次查看(过去 30 天)
I have a set of data points (in 3D coordinates, so a nx3 matrix) that represents the boundary of a region, then I have a nx1 matrix that represents the magnitude of wall shear stress in the corresponding point. I want to represent these data as in the figure I attached. I also attach a set of coordinates and the corresponding set of magnitude values.

回答(1 个)

VINAYAK LUHA
VINAYAK LUHA 2023-11-24
Hi Jacopo,
I understand that you have a set of coordinate points representing the boundary of a region and an array indicating the shear stress values at these points. Further, you wish to visualize this data in MATLAB using color mapping to represent the magnitude at the respective points.
Here is how you can create a 3D surface plot with color mapping based on magnitude values-
  1. Create a 3D delaunay triangulation based on the input coordinates using the "delaunay" function.
  2. Normalize the shear stress magnitude values to the range [0, 1] for color mapping.
  3. Next, Create a 3D surface plot with color mapping based on the normalized magnitude values using the "trisurf" function.
  4. Finally, use a colormap and include a colorbar to represent the magnitude values.
The following code demonstrates the aforementioned method-
load('coordinates.mat');
load('wssdata.mat');
tri = delaunay(coordinates(:,1), coordinates(:,2), coordinates(:,3));
normalized_magnitude = (wssdata - min(wssdata)) / (max(wssdata) - min(wssdata));
figure;
trisurf(tri, coordinates(:,1), coordinates(:,2), coordinates(:,3), normalized_magnitude, 'FaceColor', 'interp', 'EdgeColor', 'none');
colorbar('Ticks', linspace(min(wssdata), max(wssdata), 5), 'TickLabels', arrayfun(@num2str, linspace(min(wssdata), max(wssdata), 5), 'UniformOutput', false));
colormap('jet');
xlabel('X-axis');
ylabel('Y-axis');
zlabel('Z-axis');
title('3D Surface Plot with Color-Mapped Magnitude Values');
Further, refer to the following documentations to know more about the functions used in the above code -
  1. https://www.mathworks.com/help/matlab/ref/delaunay.html
  2. https://www.mathworks.com/help/matlab/ref/trisurf.html
  3. https://www.mathworks.com/help/matlab/ref/colorbar.html
Hope this helps you to understand to create a 3D surface plot with color mapping based on magnitude values.
Regards,
Vinayak Luha

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by