www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/SpecifyIntervalOfMeshPlotAndPlotPiecewiseInputExample.m

    %% Specify Interval of Mesh Plot and Plot Piecewise Input
% Plot the piecewise input
% 
% $$ \matrix{{\rm erf}(x) + \cos(y) & -5 < x < 0 \cr \sin(x) + \cos(y) & 0 < x < 5}$$
% 
% over the interval $-5 < y < 5.$ 
%
% Specify the plotting interval as the second argument of |fmesh|. When you
% plot multiple inputs over different intervals in the same axes, the axis
% limits adjust to include all the data. 

fmesh(@(x,y) erf(x)+cos(y),[-5 0 -5 5])
hold on
fmesh(@(x,y) sin(x)+cos(y),[0 5 -5 5])
hold off