2
votes

I want to take two log plots and compare one overlaid on the other. For linear plots, I can use figure; Hold on; plot(first) plot(second) and they are plotted one over the other. (As expected)

BUT, if I use a log plot, say for a BODE plot, when I use the "Hold on" command, it changes the x-axis to linear and I lose the log scale on the x-axis.
Example Code below

figure;
hold on;
semilogx(omega,20*log10(abs(c_Hs)),'r');  % transfer function #1
semilogx(omega,20*log10(abs(c_HsR)),'b');  % Transfer function #2

so HOW do i prevent "hold on" from changing the log scale to linear ???

1

1 Answers

1
votes

Place the hold on; expression after the first semilogx call

figure;
semilogx(omega,20*log10(abs(c_Hs)),'r');  % transfer function #1
hold on;
semilogx(omega,20*log10(abs(c_HsR)),'b');  % Transfer function #

Or pass both sets of data to the plotting function:

figure;
semilogx(omega,20*log10(abs(c_Hs)),'r',omega,20*log10(abs(c_HsR)),'b');