% new DFOD scheme, comparison clear all;close all;warning off; ts=0.001;fs=1/ts;fn=fs/2; r= .5; f=logspace(-2,3,200);w=2*pi*f; s=j*w;g0m=abs(s.^r);g0p=angle(s.^r) *180/pi; % ---- make comparison between Tustin+CFE and AA-CFE. for norder=3:3 figure; % base line plot [b2,a2]=tustin_cfe(norder,r,ts); sys2=tf(b2,a2,ts); [mag2,pha2]=bode(sys2,w); subplot(2,1,1);plot(f,mag2(1,:),'b'),grid on;hold on; subplot(2,1,2);plot(f,pha2(1,:),'b'),grid on;hold on; a=0:.25:1; plottype=[['-r '];[':c '];['--m'];['-.k'];['-Or']]; for iw=1:5 % new sys3=newdfod(norder,ts,a(iw),r); [mag3,pha3]=bode(sys3,w); subplot(2,1,1);plot(f,mag3(1,:),plottype(iw,:)),grid on;hold on; % subplot(2,1,2);plot(f,pha3(1,:),plottype(iw,:)),grid on;hold on; subplot(2,1,2);plot(f,pha3(1,:)+angle( (exp(s*ts)).^(0.*r)) *180/pi,plottype(iw,:)),grid on;hold on; end subplot(2,1,1);plot(f,g0m,'k'),grid on;hold on; ax=axis;ax(2)=fs/2;ax(3)=0;ax(4)=700*r;axis(ax); subplot(2,1,2);plot(f,g0p,'k'),grid on;hold on; ax=axis;ax(2)=fs/2;ax(3)=0;ax(4)=50*2*r;axis(ax); legend( ['s^{0.5}: Tustin + CFE, t_s=0.001s, N=',num2str(norder)], ... ['s^{0.5}: new DFOD, t_s=0.001s, N=',num2str(norder), 'a=0'], ... ['s^{0.5}: new DFOD, t_s=0.001s, N=',num2str(norder), 'a=.25'], ... ['s^{0.5}: new DFOD, t_s=0.001s, N=',num2str(norder), 'a=.5'], ... ['s^{0.5}: new DFOD, t_s=0.001s, N=',num2str(norder), 'a=.75'], ... ['s^{0.5}: new DFOD, t_s=0.001s, N=',num2str(norder), 'a=1'], ... ['s^{0.5}: continuous Bode']) end %norder