Representation of wall shear stress in 3D

5 ビュー (過去 30 日間)
Jacopo Rossi
Jacopo Rossi 2022 年 4 月 4 日
回答済み: VINAYAK LUHA 2023 年 11 月 24 日
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 Center および File ExchangeSurface 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