使用MATLAB的m函数画伯德图,设置显示横坐标为HZ

代码如下:

P=bodeoptions;
P.Grid='on';
P.XLim={[10      1000000]};%设置横轴范围
P.FreqUnits='Hz';%将横坐标单位换位HZ
% P.YLim={[-160     50]};%设置纵轴范围
num1=[1];
den1=[2*0.3*10e-12    0   2.3e-3    0];
G1=tf(num1,den1);

num1=[1];
den1=[2*0.5*10e-12    0   2.5e-3    0];
G2=tf(num1,den1);

num1=[1];
den1=[2*1*10e-12    0   3e-3    0];
G3=tf(num1,den1);
bode(G1,G2,G3,P)

其中P是bode函数的配置(bodeoptions),在命令窗口输入ans即可看到默认的bodeoptions参数

G1,G2,G3是我定义的三个传递函数

这是默认的>> bodeoptions参数

ans =

                   FreqUnits: 'rad/s'
                   FreqScale: 'log'
                    MagUnits: 'dB'
                    MagScale: 'linear'
                  MagVisible: 'on'
             MagLowerLimMode: 'auto'
                  PhaseUnits: 'deg'
                PhaseVisible: 'on'
               PhaseWrapping: 'off'
               PhaseMatching: 'off'
           PhaseMatchingFreq: 0
    ConfidenceRegionNumberSD: 1
                 MagLowerLim: -Inf
          PhaseMatchingValue: 0
         PhaseWrappingBranch: -180
                  IOGrouping: 'none'
                 InputLabels: [1×1 struct]
                OutputLabels: [1×1 struct]
                InputVisible: {'on'}
               OutputVisible: {'on'}
                       Title: [1×1 struct]
                      XLabel: [1×1 struct]
                      YLabel: [1×1 struct]
                   TickLabel: [1×1 struct]
                        Grid: 'off'
                   GridColor: [0.1500 0.1500 0.1500]
                        XLim: {[1 10]}
                        YLim: {[1 10]}
                    XLimMode: {'auto'}
                    YLimMode: {'auto'}

猜你喜欢

转载自blog.csdn.net/qq_33374294/article/details/86371861