假設開環傳遞函式為:
G(s)=Vin*(1+s/wz)/(1+s/(wo*Q)+s^2/wo^2),
其中,wz=1/(rc*C),wo=1/sqrt(LC),Q=1/sqrt(L/C)
引數設定如下:
Vin=20,L=50uH,C=500uF,R=1ohm,Rc=0.01ohm,Rl=0.25ohm
開環傳遞函式的分子係數:Vin,Vin/wz 分母系數:1,1/Q/w0,1/w0^2
透過tf函式求出閉環傳遞函式:G1=tf([Vin/wz Vin],[1/w0^2 1/q/w0 1]);
程式碼如下:
Vin=20;l=50e-6;c=500e-6;r=1;rl=0.25;rc=0.01;
w0=1/(l*c)^0.5;
wz=1/rc/c;
wzl=rl/l;
q=r/(l/c)^0.5;
G1=tf([Vin/wz Vin],[1/w0^2 1/q/w0 1]);
下面繪製bode圖:
1.應用margin函式
margin(G1)就可以得到bode圖
2.透過bode函式
首先可以透過bodeoptions函式使繪製圖形變得豐富。在命令視窗輸入
bodeoptions
ans =
Title: [1x1 struct]
XLabel: [1x1 struct]
YLabel: [1x1 struct]
TickLabel: [1x1 struct]
Grid: "off"
XLim: {[1 10]}
XLimMode: {"auto"}
YLim: {[1 10]}
YLimMode: {"auto"}
IOGrouping: "none"
InputLabels: [1x1 struct]
OutputLabels: [1x1 struct]
InputVisible: {"on"}
OutputVisible: {"on"}
FreqUnits: "rad/s"
FreqScale: "log"
MagUnits: "dB"
MagScale: "linear"
MagVisible: "on"
MagLowerLimMode: "auto"
MagLowerLim: 0
PhaseUnits: "deg"
PhaseVisible: "on"
PhaseWrapping: "off"
PhaseMatching: "off"
PhaseMatchingFreq: 0
PhaseMatchingValue: 0
ConfidenceRegionNumberSD: 1
可以按照對應來滿足自己的求解需要:
程式碼:
%margin(G1)
p=bodeoptions;
p.FreqUnits="Hz";
p.Grid="on";
bode(G1,p)
就可以得到需要的bode圖形了。
假設開環傳遞函式為:
G(s)=Vin*(1+s/wz)/(1+s/(wo*Q)+s^2/wo^2),
其中,wz=1/(rc*C),wo=1/sqrt(LC),Q=1/sqrt(L/C)
引數設定如下:
Vin=20,L=50uH,C=500uF,R=1ohm,Rc=0.01ohm,Rl=0.25ohm
開環傳遞函式的分子係數:Vin,Vin/wz 分母系數:1,1/Q/w0,1/w0^2
透過tf函式求出閉環傳遞函式:G1=tf([Vin/wz Vin],[1/w0^2 1/q/w0 1]);
程式碼如下:
Vin=20;l=50e-6;c=500e-6;r=1;rl=0.25;rc=0.01;
w0=1/(l*c)^0.5;
wz=1/rc/c;
wzl=rl/l;
q=r/(l/c)^0.5;
G1=tf([Vin/wz Vin],[1/w0^2 1/q/w0 1]);
下面繪製bode圖:
1.應用margin函式
margin(G1)就可以得到bode圖
2.透過bode函式
首先可以透過bodeoptions函式使繪製圖形變得豐富。在命令視窗輸入
bodeoptions
ans =
Title: [1x1 struct]
XLabel: [1x1 struct]
YLabel: [1x1 struct]
TickLabel: [1x1 struct]
Grid: "off"
XLim: {[1 10]}
XLimMode: {"auto"}
YLim: {[1 10]}
YLimMode: {"auto"}
IOGrouping: "none"
InputLabels: [1x1 struct]
OutputLabels: [1x1 struct]
InputVisible: {"on"}
OutputVisible: {"on"}
FreqUnits: "rad/s"
FreqScale: "log"
MagUnits: "dB"
MagScale: "linear"
MagVisible: "on"
MagLowerLimMode: "auto"
MagLowerLim: 0
PhaseUnits: "deg"
PhaseVisible: "on"
PhaseWrapping: "off"
PhaseMatching: "off"
PhaseMatchingFreq: 0
PhaseMatchingValue: 0
ConfidenceRegionNumberSD: 1
可以按照對應來滿足自己的求解需要:
程式碼:
Vin=20;l=50e-6;c=500e-6;r=1;rl=0.25;rc=0.01;
w0=1/(l*c)^0.5;
wz=1/rc/c;
wzl=rl/l;
q=r/(l/c)^0.5;
G1=tf([Vin/wz Vin],[1/w0^2 1/q/w0 1]);
%margin(G1)
p=bodeoptions;
p.FreqUnits="Hz";
p.Grid="on";
bode(G1,p)
就可以得到需要的bode圖形了。