how to draw multiple surfaces

Hello, i would appreciate if someone knows how to draw multiple (several) surfaces in one figure (only one surface is created using the command "surf(x,y,z)") ? also how to draw a surface and a line in the same figure ? i guess this is related with combining-joining two (several) objects in one figure ... ? Thanks.

回答(2 个)

e.g.
sf1 = @(X,Y)sqrt(4*X.^2+3*Y.^2);
sf2 = @(X,Y)sqrt(X.^2+Y.^2);
[X,Y]=ndgrid(-2:.1:2,-2:.1:2);
figure
surf(sf1(X,Y));
hold on
surf(sf2(X,Y));
The searched command is "hold", see help hold.
Another approach is creating the AXES object by:
AxesH = axes('NextPlot', 'add');
The default is 'NextPlot'='replace' such that inserting a new object delete already created objects.

类别

帮助中心File Exchange 中查找有关 Graphics Object Properties 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by