Plot 2D flux maps in 3D

2 views (last 30 days)
Philip Hoskinson
Philip Hoskinson on 8 Dec 2018
Answered: ProblemSolver on 13 Jul 2023
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!

Answers (1)

ProblemSolver
ProblemSolver on 13 Jul 2023
% 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

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!