How to create a 4D surface from scattered data?

7 次查看(过去 30 天)
I have 245 results of a variable C, which are the combination of 3 indepent variables x, y, z.
I am modelling on a CFD software which interpolates betwen these 245 results, and it would be really interesting to plot which points are the seeked points/ area of points.
I have tried with an scatter3 as shown below, but it is not very graphic. Could not make "surf" work as I intended. Does anybody have an idea of a more graphic way to do this?
Thank you
figure(3)
clf
scatter3(Ti(:,1), Ni(:,1), Ai(:,1),100,Mapeado020(:,5), "filled") %245 results which were interpoled
hold on
scatter3(TcK020(:,1), Nc020(:,1), Ac020(:,1),"red","x") %simulation 1 points
scatter3(TcK530(:,1), Nc530(:,1), Ac530(:,1),"blue","x") %simulation 2 points
scatter3(TcK540(:,1), Nc540(:,1), Ac540(:,1),"green", "x") %simulation 3 points
colormap("cool")
hold off

回答(1 个)

arushi
arushi 2024-9-3
Hi Xavier,
I understand that you have 245 results of a variable C, interpolated from 3 independent variables x, y, and z. You want to visualize these interpolated points in a more visually appealing way than a scatter plot. You have tried using the ‘surf’ function, but it did not work as expected. You are looking for alternative ideas or approaches to create a more graphic and visually appealing plot for these points.
You can use a combination of ‘scatter3’ and ‘color’ mapping to visualize the interpolated points with the additional variable. Here's an updated version of the code:
% Create a scatter plot with color mapping for the interpolated points
figure;
scatter3(Ti, Ni, Ai, 100, Mapeado020(:,5), 'filled');
hold on;
% Set the color based on the additional variable
scatter3(Ti, Ni, Ai, 100, Mapeado020(:,6), 'filled');
% Plot the simulation points
scatter3(TcK020, Nc020, Ac020, 'red', 'x');
scatter3(TcK530, Nc530, Ac530, 'blue', 'x');
scatter3(TcK540, Nc540, Ac540, 'green', 'x');
% Set labels and title
xlabel('X');
ylabel('Y');
zlabel('Z');
title('Interpolated Points with Simulation Points');
% Set colormap
colormap('cool');
% Add a colorbar
colorbar;
hold off;
Please refer to the following MATLAB Documentation to know more about ‘scatter3’ function:
Hope the above solution helps you.

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by