필터 지우기
필터 지우기

How to create a 4D surface from scattered data?

조회 수: 8 (최근 30일)
Xavier
Xavier 2022년 7월 13일
답변: Aman Banthia 2023년 9월 21일
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개)

Aman Banthia
Aman Banthia 2023년 9월 21일
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.
Best Regards,
Aman Banthia

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by