필터 지우기
필터 지우기

Plot 2D flux maps in 3D

조회 수: 4 (최근 30일)
Philip Hoskinson
Philip Hoskinson 2018년 12월 8일
답변: ProblemSolver 2023년 7월 13일
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에서 Polygons에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by