|
"Nasser M. Abbasi" <nma@12000.org> wrote in message <jjavf7$h7r$1@speranza.aioe.org>...
> On 3/8/2012 11:38 AM, kamuran turksoy wrote:
>
> >
> > My fault, i should not use t in f(s) function. I am clarify now
> >
> > syms s z tao
> >
> > f=(6-2*tao*s)/(6+4*s*tao+(s*tao)^2);
> > ztrans(f,s,z);
> >
>
> You are doing the same mistake. Taking the Z transform of a Laplace transform,
> which makes no sense. And I do not understand what tao is? is 'f' the Laplace
> transform? then it is a function of 's', not 't' and not 'tao'. I do not
> know why you keep putting these in there for.
>
> > Actually i have tried the way you suggested. First i took inverse laplace then
> >i took z transporm of function of t.
>
> No, that is not what I said. You can't apply the Z transform on a continouse
> time signal. It has to be sampled signal. discrete signal. So, you need to
> first replace 't' by 'n*T' where T is the sampling period. i.e you need
> to first sample it.
>
> >And it worked.
>
> How could it work?
>
> >But i found a problem there. Because when i use inverse laplace then
> >ztrans and then when i use the value of tao i get a discrete transfer
> >function. However before taking inverse laplace when i put value of
> >tao and then use c2d for same sampling time, results are not same.
> >And seems the one i get from c2d is correct. Here why i try ztrans because
> >i want to find parameter tao, in case when i assume i know tao and i
> >substitute it, results are different.
>
> I am not following you. I am not really sure what is it you are trying
> to do. Do you want to obtain Z transform and are given the Laplace transform?
>
> If so, what I said before is one way. (replace t by n*T and then do ztran,
> using 'n' as the independent variable).
>
> Here is another way:
> given F(s), we want Z transform.
> ----------------------
> s=tf('s')
> sys=F(s) % write here you laplace transform
> sysd=c2d(sys,T,'zoh') %where T is the sampling period, a number
> %this gives you the Z transform
>
> but note that here I used zero order hold to sample.
>
> --Nasser
Basically i want to obtain z domain of a given transfer function in s domain. I agree with the way you suggest but results from two ways are different. Let me give you an example. I will use same function and this time i will give a value to tao as 4
syms s z tao
f=(6-2*tao*s)/(6+4*s*tao+(s*tao)^2);
i_f=ilaplace(f,s,t); % take laplace inverse, convert s domain to s
z_f=ztrans(i_f,t,z); % take z transform, convert from t domain to z
z_f_d=subs(z_f,tao,4); % substitute 4 instead of tao
z_f_d=simplify(z_f_d) % simplify function
...
...
z_f_d=
-5.4366 + 7.13 z^-1
---------------------------------------
10.8731 -12.37z^-1 +4z^-2
Now i will use same function for second way. again tao=4
s=tf('s');
F=(6-8*s)/(6+16*s+16*s^2;
sysd=c2d(F,1,'zoh')
Transfer function:
-0.163 z + 0.3928
------------------------------
z^2 - 1.138 z + 0.3679
And i just found instead 'zoh' if i use 'imp' it give same result as first method.
sysd=c2d(F,1,'imp')
Transfer function:
-0.5 z^2 + 0.6557 z
----------------------
z^2 - 1.138 z + 0.3679
And i want to use result i got from zero hold sampling way. So how can i use inverse lapce-ztrans way but with zero hold sampling. Because result i get from sysd=c2d(F,1,'zoh') is the one i need. Here before calculation i assumed i know tao, thus i could use c2d but in reality i do not know before these calculation. So i have to use ilaplace-ztrans way.
|