**neoflash wrote on Jun 1**^{st}, 2009, 8:13pm:How can I realize a system H(s)=a-b*e(-s*T) in matlab and view its group delay?

a=3;

b=1;

Tdelay=1e-9;

H1=tf(a, 1);

H2=tf(b, 1);

set(H2, 'Outputdelay', Tdelay);

% s=tf('s');

% H2=b*exp(-s*Tdelay);

H1=ss(H1);

H2=ss(H2);

Hc=H1-H2;

freq=logspace(3, 10, 2000);

figure(1), bode(Hc, 2*pi*freq)

z=freqresp(Hc, 2*pi*freq);

x=real(squeeze(z));

y=imag(squeeze(z));

df=diff(freq');

dx=diff(x);

dy=diff(y);

freq=freq(1:length(freq)-1);

x=x(1:length(x)-1);

y=y(1:length(y)-1);

Gdelay=-(dy.*x-y.*dx)./(x.^2+y.^2)./(2*pi*df);

figure(2), semilogx(freq, Gdelay)

There is another method to evaluate Group Delay if you approximate Hc(s) as Hd(z).

You can approximate Hc(s) as Hd(z) by using

*c2d*().

Here Hc(s) means continuous time transfer function, Hd(z) means discrete time transfer function.

After getting Hd(z) as approximation of Hc(s), you can use

*grpdelay*().

Following Hd(z) is Impulse-Invariant Discretization of Hc(s).

Hd=tf([a -b], [1 0], Tdelay);

See result of "doc

*c2d*" in command window of MATLAB.

**neoflash wrote on Jun 1**^{st}, 2009, 8:44pm:H = tf([3 -1],[1 0],1e-9);

bode(H);

I found that I could represent it as z-tf. Then how can I calculate the group delay?