MATLAB: How to add a bode plot to an existing bode plot within a subplot in MATLAB

bodebodemagimpulseiopzmapltiviewMATLABnicholsnyquistpzmapsigmastepsubplot

When I create a set of subplots using BODE function and try to add a new system to the first subplot, the first set of bode plots disappears. This occurs for any of the LTIVIEW plottypes. For example:
subplot(211);
bode(sys1);
hold on;
subplot(212);
bode(sys2);
hold on;
subplot(211);
bode(sys3);
reproduces the behavior.

Best Answer

To plot a new set of bode plots on the existing subplots, while preserving the previous plots, use the handle to the subplot. This will allow bode(sys1) and bode(sys3) on the same set of axes after producing a new subplot - bode(sys2) - between the first and third subplots. The following code illustrates this:
h1 = subplot(211);
bode(sys1);
hold on;
h2 = subplot(212);
bode(sys2);
hold on;
set(gcf,'currentaxes',h1);
bode(sys3);
Related Question