Mapping a temperature data from a csv file contains four columns (x, y, z, temperature) into a stl CAD model to use in static-structural analysis in MATLAB

20 次查看(过去 30 天)
Hello everyone,
I am trying to solve a static-strctural analysis in MATLAB. The applied load is a thermal load (temperure ) solved by Ansys Fluent and exported in the from of csv format.
My question is how to map the csv file which contains four columns for the position and tempertaure value of mesh nodes (x,y,z, temperature) to the stl CAD file which is already read, loaded, and meshed into MATLAB.
Thank you in advance

回答(1 个)

Animesh
Animesh 2023-8-24
编辑:Animesh 2023-8-24
I understand that you want to map the temperature values from the CSV file to the mesh nodes in MATLAB. You can follow these steps for this:
  • Load the CSV file into MATLAB using the "readmatrix" function: - Assuming that your CSV file is named "temperature.csv", you can use the following code:
data = readmatrix('temperature.csv');
  • Extract the x, y, z coordinates and the temperature values from the loaded data: - Assuming that the columns in the CSV file are ordered as "x", "y", "z" and "temperature", you can use the following code:
x = data(:, 1);
y = data(:, 2);
z = data(:, 3);
temperature = data(:, 4);
  • Use the "dsearchn" function to find the nearest mesh nodes in the STL CAD file for each (x, y, z) coordinate: - The "dsearchn" function performs a nearest neighbour search in a set of points. Assuming that you have already loaded and meshed the STL CAD file, you can use the following code:
nodes = [x, y, z];
[meshIndices, dist] = dsearchn(meshNodes, nodes);
Here, "meshNodes" should be a matrix containing the coordinates of the mesh nodes in the STL CAD file.
"meshIndices" is the indices of the closest points in "meshNodes" to the query points in nodes measured in Euclidean distance.
"dist" is the Euclidean distances between each query point and the closest input point in "meshNodes".
Make sure to adjust the code according to your specific file formats and data structures.
The documentation for "readmatrix" and "dsearchn" are listed below: -

类别

Help CenterFile Exchange 中查找有关 Data Import and Analysis 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by