%%初始传递函数计算
% syms s;
s=tf('s');
Dx=0.4;Uo=100;R=50;L=200e-6;C=20e-6;%占空比0.6 Dx=1-0.6=0.4
Gvd=Dx*Uo*(1-(s*L/((Dx^2)*R)))/(L*C*s^2+(L/R)*s+Dx^2);%pwm到输出
G=Gvd/20/6;%开环传递函数
simplify(G)%%公式化简;
[mag,phase,w]=bode(G);
margin(mag,phase,w);% %%%%%%%初始bode图
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Gcb=(1+5.9e-5*s)/(1+4.24e-6*s);%%不加k的校正函数
% % % % Gcb=6.7e-5*(1+s/1.67e4)/(1+s/9.5e5);
% Gc1b=G*Gcb*2;%% 加上PD和k后
GPI=(s+6.3e2)/s;%% PI环节
% GPID=Gcb*GPI*2/6;
fin_G=Gcb*GPI;
GG=Gcb*G*2*GPI
% simplify(GPID)%%公式化简
% [mag,phase,w]=bode(Gc1b);
% margin(mag,phase,w);% %%%%%%% bode图
% Gpid=401.47*(1+0.00045*s)^2/s
[mag,phase,w]=bode(GG);
margin(mag,phase,w);% %%%%%%% bode图