# Simple z-transform question

Started by February 7, 2005
```Hi,

The transfer function for a lossy integrater is

H(z) = z/(z-c)

the magnitude spectrum is given by

M(f) = |z|/|z-c|

so lets say I have a c value of 0.8, how do I plot M(f)? I simply
tried plugging in values for z ni the range of 0 to 1, but this does
not give me what I would expect and I think I'm totally
misunderstanding the z transorm.

Any help?
```
```?ine Canby wrote:

> Hi,
>
> The transfer function for a lossy integrater is
>
> H(z) = z/(z-c)
>
> the magnitude spectrum is given by
>
> M(f) = |z|/|z-c|
>
> so lets say I have a c value of 0.8, how do I plot M(f)? I simply
> tried plugging in values for z ni the range of 0 to 1, but this does
> not give me what I would expect and I think I'm totally
> misunderstanding the z transorm.
>
> Any help?

You are following a rote procedure that you learned from the Laplace
domain, and since you don't understand it you're not applying it
correctly to the z domain.

In Laplace M(f) = |H(2*pi*j*f)| assuming that f is a frequency in Hz (so
you plug in the j*omega operator).  This works because the Laplace
transform of a sine wave is L{sin(w*t)} = (1/2)*(1/(s + jw) - 1/(s -
jw)), and finding the response to the transform boils down to finding
the partial fraction expansion of (1/2)*(1/(s + jw) - 1/(s - jw))*H(s),
which boils down to finding H(jw).

The z domain is different from the Laplace domain.  The z transform of a
sine wave is Z{sin(w*k)} = (1/2)(1/(z - e^{j*w}) - 1/(z - e^{-j*w})).
Go through all the partial fraction expansion gyrations and you're left
with finding H(e^{j*w}).

So in the z domain you find |H(e^{2*pi*j*f*Ts})|, where Ts is your
sampling time and f is in Hz, and all is well.  I prefer to roll all the
frequency stuff into an angle (I usually call it theta, sometimes phi).
This serves to remind me that I'm working in the sampled-time domain
and I can't blithely cross from real continuous time to sampled time

In both frequency response cases you're tracing the stability boundary.
In the Laplace domain this is the imaginary axis, where any pole with
a negative real part is stable and any pole with a positive real part is
unstable.  In the z domain this is the unit circle, where any pole with
an absolute value less than one is stable and any pole with an absolute
value greater than one is unstable.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
```
```"Tim Wescott" <tim@wescottnospamdesign.com> wrote in message
news:110fbskq97rijd2@corp.supernews.com...
> ?ine Canby wrote:
>
>> Hi,
>>
>> The transfer function for a lossy integrater is H(z) = z/(z-c)
>>
>> the magnitude spectrum is given by M(f) = |z|/|z-c|
>>
>> so lets say I have a c value of 0.8, how do I plot M(f)? I simply
>> tried plugging in values for z ni the range of 0 to 1, but this does
>> not give me what I would expect and I think I'm totally
>> misunderstanding the z transorm.
>>
>> Any help?
>
> You are following a rote procedure that you learned from the Laplace
> domain, and since you don't understand it you're not applying it correctly
> to the z domain.
>
> In Laplace M(f) = |H(2*pi*j*f)| assuming that f is a frequency in Hz (so
> you plug in the j*omega operator).  This works because the Laplace
> transform of a sine wave is L{sin(w*t)} = (1/2)*(1/(s + jw) - 1/(s - jw)),
> and finding the response to the transform boils down to finding the
> partial fraction expansion of (1/2)*(1/(s + jw) - 1/(s - jw))*H(s), which
> boils down to finding H(jw).
>
> The z domain is different from the Laplace domain.  The z transform of a
> sine wave is Z{sin(w*k)} = (1/2)(1/(z - e^{j*w}) - 1/(z - e^{-j*w})). Go
> through all the partial fraction expansion gyrations and you're left with
> finding H(e^{j*w}).
>
> So in the z domain you find |H(e^{2*pi*j*f*Ts})|, where Ts is your
> sampling time and f is in Hz, and all is well.  I prefer to roll all the
> frequency stuff into an angle (I usually call it theta, sometimes phi).
> This serves to remind me that I'm working in the sampled-time domain and I
> can't blithely cross from real continuous time to sampled time without
>
> In both frequency response cases you're tracing the stability boundary. In
> the Laplace domain this is the imaginary axis, where any pole with a
> negative real part is stable and any pole with a positive real part is
> unstable.  In the z domain this is the unit circle, where any pole with an
> absolute value less than one is stable and any pole with an absolute value
> greater than one is unstable.

...like Tim said.  And, if you don't like the exponential representation,
you want to evaluate where z=a+jb and |z|=sqrt(a^2+b^2)=1 for all a and b
that satisfy this condition.  So, the polar form z=A:theta becomes z=1:theta
where theta =0>2pi radians is easier to use and leads to the exponential
version.

Fred

```
```?ine Canby wrote:
> Hi,
>
> The transfer function for a lossy integrater is
>
> H(z) = z/(z-c)
>
> the magnitude spectrum is given by
>
> M(f) = |z|/|z-c|
>
> so lets say I have a c value of 0.8, how do I plot M(f)? I simply
> tried plugging in values for z ni the range of 0 to 1, but this does
> not give me what I would expect and I think I'm totally
> misunderstanding the z transorm.
>
> Any help?

No that won't work, given

H(z) = z/(z-c)

To get the "analog" frequency response you just need to substitute
z=cexp(jwT) and vary w, where w is the frequency is rad/sec, T is
sample period is seconds, and cexp is the complex exponent

Everything is much easier if you use a language that supports complex
math(C++ class,mathcad or even fortran) , in good old fortran its
trivial
j=(0,1)
jw=j*w
z=cexp(jw*T)
h=z/(z-c) ! Or substitute any z transfer function here
magnitude=20*log10(cabs(h))
phase =atan2d(aimag(h),real(h))

and if you want to compare the magnitude and phase response with an
analog filter, then
s = clog(z)/T ! by definition
hs = 1/(s+a)   ! Or substitue any s transfer function here
magnitude=20*log10(cabs(hs))
phase =atan2d(aimag(hs),real(hs))

```