How to plot several 3D funztions (Z_n=f_n(x,y) with arbitrary intervals for each of them in one coordinate system?

1 次查看(过去 30 天)
I have two functions (Z1=f(x,y) and Z2=f(x,y)) want to plot in one coordinate system but with different intervals interval_Z1=[x1_min, x1_max, y1_min, y1_max] and interval_Z2=[x2_min, x2_max, y2_min, y2_max] using fsurf and hold on commands, but it seems something went wrong and Matlab could not plot them in one coordinates and only plots one of them.
What the problem is?
Totally, how to plot several 3D funztions (Z_n=f_n(x,y) with arbitrary intervals for each of them in one coordinate system?
What about to plot them by only one command in one line, instead of using several hold on command with different commands?

回答(1 个)

KSSV
KSSV 2022-1-24
It is plotting both the surfaces, but they are in the same colormap and you are unable to differentiate them. Check this:
figure
syms x y
% give f1 and f4 your functions
%figure
ax1 = axes ;
fsurf(f1,[0, 0.00995, 0, 0.02]);
hold on
ax2 = axes ;
fsurf(f4,[0.01005,0.02,0,0.02]);
hold off
linkaxes([ax1,ax2])
%%Hide the top axes
ax2.Visible = 'off';
ax2.XTick = [];
ax2.YTick = [];
%%Give each one its own colormap
colormap(ax1,'hot')
colormap(ax2,'cool')
  3 个评论

请先登录,再进行评论。

类别

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

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by