www.gusucode.com > symbolic 源码程序 matlab案例代码 > symbolic/PlotMultipleContourPlotsOnSameFigureExample.m

    %% Plot Multiple Contour Plots on Same Figure
% Plot multiple contour plots either by passing the inputs as a
% vector or by using |hold on| to successively plot on the same figure.
% If you specify |LineStyle| and Name-Value arguments, they apply to all contour plots. You
% cannot specify individual |LineStyle| and Name-Value pair arguments for each plot.  
% 
% Divide a figure into two subplots by using |subplot|. On the first subplot,
% plot $\sin(x)+\cos(y)$ and $x-y$ by using vector input. On the second
% subplot, plot the same expressions by using |hold on|.

syms x y
subplot(2,1,1)
fcontour([sin(x)+cos(y) x-y])
title('Multiple Contour Plots Using Vector Inputs')

subplot(2,1,2)
fcontour(sin(x)+cos(y))
hold on
fcontour(x-y)
title('Multiple Contour Plots Using Hold Command')

hold off