Plot 3D with differents axis size

조회 수: 4 (최근 30일)
Ilias Bouchkira
Ilias Bouchkira 2021년 9월 27일
답변: Abhishek Chakram 2023년 10월 11일
Dear all,
I'm trying to plot in one figure F_1 (in Fig1) and i would like to hold on F_2 in points ('*');
subplot(1,2,1)
mesh(x,tspan,F_1);
title('Plot N 1')
subplot(1,2,2)
mesh(x,tspan,F_2);
title('Plot N 2');
% i can not use plot3D(x,tspan,F_3), since x and tspan are not the same
% length
**
Can someone please tell me how to hold on F_2 (Plot N°2) with points;
Thanks in advance;

답변 (1개)

Abhishek Chakram
Abhishek Chakram 2023년 10월 11일
Hi Ilias Bouchkira,
It is my understanding that you want to merge multiple mesh plots into a single plot. Here is an example for the same:
% Create sample data
[X1, Y1] = meshgrid(-2:0.2:2);
Z1 = sin(sqrt(X1.^2 + Y1.^2));
[X2, Y2] = meshgrid(-2:0.1:2);
Z2 = cos(X2) + sin(Y2);
% Create a figure
figure('Name', 'Combined Mesh Plots');
% Plot the first mesh plot
mesh(X1, Y1, Z1);
hold on;
% Plot the second mesh plot
mesh(X2, Y2, Z2);
% Set plot properties
title('Combined Mesh Plots');
xlabel('X');
ylabel('Y');
zlabel('Z');
% Add a legend
legend('Mesh Plot 1', 'Mesh Plot 2');
% Adjust the view
view(3);
You can refer to the following documentation to know more about the functions used:
Best Regards,
Abhishek Chakram

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by