Filter löschen
Filter löschen

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 Ansichten (letzte 30 Tage)
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

Antworten (1)

Animesh
Animesh am 24 Aug. 2023
Bearbeitet: Animesh am 24 Aug. 2023
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: -

Kategorien

Mehr zu Spatial Search finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by