The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Simulators >> System Simulators >> How to represent a laplace system in matlab?
https://designers-guide.org/forum/YaBB.pl?num=1243912419

Message started by neoflash on Jun 1st, 2009, 8:13pm

Title: How to represent a laplace system in matlab?
Post by neoflash on Jun 1st, 2009, 8:13pm

How can I realize a system H(s)=a-b*e(-s*T) in matlab and view its group delay?

Thanks,
Neo

Title: Re: How to represent a laplace system in matlab?
Post by neoflash on Jun 1st, 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?

Title: Re: How to represent a laplace system in matlab?
Post by thechopper on Jun 2nd, 2009, 6:30pm

Hi Neoflash,

Is not the delay constant here? It looks like a sampler transfer function, which has linear phase or constant delay....

Regards
Tosei

Title: Re: How to represent a laplace system in matlab?
Post by raja.cedt on Jun 4th, 2009, 4:42am

hi Neo ,
           could you please explain how did you represented your TF in mat lab? i didn't understand that reply you have given?

Thanks,
Rajasekhar.

Title: Re: How to represent a laplace system in matlab?
Post by neoflash on Jun 6th, 2009, 7:29pm


HdrChopper wrote on Jun 2nd, 2009, 6:30pm:
Hi Neoflash,

Is not the delay constant here? It looks like a sampler transfer function, which has linear phase or constant delay....

Regards
Tosei



For a system like: H(s)=a-b*e(-s*T). The group delay is not constant.

Title: Re: How to represent a laplace system in matlab?
Post by pancho_hideboo on Jun 8th, 2009, 1:57am


neoflash wrote on Jun 1st, 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 1st, 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?


The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.