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

1 view (last 30 days)
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?

Answers (1)

KSSV
KSSV on 24 Jan 2022
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 Comments

Sign in to comment.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!