How can I display 4th dimensional plot using ASCII data from ANSYS Fluent?
5 views (last 30 days)
Show older comments
I am simulating 4th dimensional model to study cavitational number, to predict the possibility of cavitation damage using ANSYS Fluent. I do found that MATLAB can do plotting using ASCII data into 4th dimensional model (3d+color).
Here are the reference that i found on google photo:
This ASCII data are exported from ANSYS Fluent, and then, inputted into a Matlab program to do some calculation to find cavitation number. The file are then save as text file (ASCII format). This text file has the "node number", "x-coordinate", "y-coordinate", "z-coordinate" and "cavitation number" as shown in the file given. For cavitation number, it will indicate the contour plot or indicate the color.
The main objective is to do 4th dimentional plot using ASCII data.
2 Comments
Rik
on 25 May 2022
If you want this exact plot, you don't need to plot the entire cube, only the faces.
Answers (1)
Avni Agrawal
on 23 Jan 2024
I understand that you are trying to create 4th-dimensional plot using the ASCII data.The ASCII data includes "node number", "x-coordinate", "y-coordinate", "z-coordinate", and "cavitation number". To plot a 4th-dimensional model in MATLAB, you can use the scatter3 function to create a 3D scatter plot and use the "cavitation number" to determine the color of each point.
Please find the code snippet mentioned below:
% Assuming data is loaded into MATLAB with variable names corresponding to the columns
% node_number, x_coordinate, y_coordinate, z_coordinate, cavitation_number
% Load your data here
% For example, if your data is in a text file named 'data.txt', you can use the following:
data = dlmread('./C1.txt', '\t', 1, 0);
x_coordinate = data(:, 2);
y_coordinate = data(:, 3);
z_coordinate = data(:, 4);
cavitation_number = data(:, 5);
% Create a 3D scatter plot
scatter3(x_coordinate, y_coordinate, z_coordinate, [], cavitation_number, 'filled');
% Add color bar to indicate the scale of cavitation number
colorbar;
% Label the axes
xlabel('X Coordinate');
ylabel('Y Coordinate');
zlabel('Z Coordinate');
title('4D Plot of Cavitation Number');
% Optionally, you can adjust the view angle for better visualization
view(3); % Sets the default 3D view
% Adjust the colormap if needed
colormap(jet); % This is just an example; you can choose any colormap you like
% Ensure the plot is updated
drawnow;
I hope this helps.
0 Comments
See Also
Categories
Find more on Scatter Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!