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

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


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