Plot 2D flux maps in 3D

2 次查看(过去 30 天)
Philip Hoskinson
Philip Hoskinson 2018-12-8
How do I portray my 2D contourf plots in 3D?
I have three simple rectangular surfaces that I am plotting contourf maps of, but I want to connect their edges and portray in 3D (they are not in plane, sort of like a piece of paper folded at 90 degrees, or any degree for that matter).
So I have for example:
Panel 1
[ 23 54 ]
[34 65]
Panel 2
[76 34]
[34 65]
Actual widths and angles between panels are known. They are not perfect squares.
Eventually I want to connect multiple V-shaped panels, in a circular shape sort of like a car air filter.
Thanks!

回答(1 个)

ProblemSolver
ProblemSolver 2023-7-13
% Define the data for the panels
panel1 = [23, 54, 0; 34, 65, 0]; % Replace with your data for panel 1
panel2 = [76, 34, 0; 34, 65, 0]; % Replace with your data for panel 2
% Define other panels as needed
% Define the vertices and faces for the patches
vertices = [panel1; panel2]; % Combine the vertices of the panels
faces = [1, 2, 4, 3]; % Define the face indices based on the vertex order
% Assign colors to the vertices
colors = [panel1(:, 1); panel2(:, 1)]; % Replace with your desired color values
% Plot the 3D surface
figure;
patch('Vertices', vertices, 'Faces', faces, 'FaceVertexCData', colors, 'FaceColor', 'interp', 'EdgeColor', 'none');
colorbar; % Add a colorbar if needed
% Customize the plot as needed
xlabel('X');
ylabel('Y');
zlabel('Z');
view(3); % Set the view perspective
% Add other customizations as needed

类别

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

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by