I need Matlab help comparing bode plots neatly

  1. This definitely isn't a homework question as the work is already done, I'm just trying to make my presentation neater for some reports I'm turning in.

    I am comparing theoretical data collected from a filter, to the actual data collected. I want to overlay the two to make the comparison. I am trying to do this for both the gain, and the phase difference. I have a plot for the gain, I have a plot for the phase difference, and I have the bodeplot that has both. But I can't seem to overlay everything.


    Here is the code I have if any matlab whizzes can help me figure out how to do it. All of the plots themselves are correct, I don't need help with them. I just want to overlay the gain plot and phase plot over the respective parts of the bode plot.

    sys=tf([0 -8200], [0 .12874 1570])
    bodeplot(sys) %this is the bodeplot for the theoretical values

    x=[100 1885 3142 10681 12566 14451 31416 628318 1000000]; %start of the gain plot for data
    V=[10.2 10.2 9.8 7.6 7 6.4 3.8 .3 0];
    y=20*log10(V./2);
    subplot(2,1,1); semilogx(x,y,'r') %this is the end of gain plot for data

    P=[189 189 165 140 136 126 116 92 92];
    subplot(2,1,2); semilogx(x,P,'r') %This is the phase plot for real data

    % subplot plots both the gain and phase plots together


    simply adding a "hold on" command in there doesn't over lay the bode plot on the other plots. Any suggestions or commands anybody can think of the get everything lined up?
     
  2. jcsd
  3. I figured it out. The "hold on" command works in the order that the plots are listed so essentially the form of the code that worked was

    gain plot
    hold on
    bode plot
    hold on
    phase plot

    and then it overlapped everything the way I wanted it. Just in case anybody else wants to know.
     
Know someone interested in this topic? Share a link to this question via email, Google+, Twitter, or Facebook

Have something to add?

0
Draft saved Draft deleted
Similar discussions for: I need Matlab help comparing bode plots neatly
Loading...