From: omegayen on
I am trying to verify the Z transform in MATLAB via the timeshift property.

For more information on the Z transform see http://en.wikipedia.org/wiki/Z-transform

Does anyone know why my code does not work as I would expect/how I can modify it properly. The Goal is to recover f after taking the z transform of the shifted signal, multiplying by the phase shift in the z domain, and then take the inverse z transform to recover the signal f


syms a n w k delay;
f = sin(a*n) +1i*sin(a*n);
F=ztrans(f, w)

h = sin(a*(n-delay)) +1i*sin(a*(n-delay));

iztrans(F)

H=ztrans(h, k)

zphaseshift=w^(delay);

H=zphaseshift.*H;

f_recover_via_time_shift = iztrans(H)
From: Wayne King on
"omegayen " <omegayen(a)ameritech.net> wrote in message <hth0jg$1ef$1(a)fred.mathworks.com>...
> I am trying to verify the Z transform in MATLAB via the timeshift property.
>
> For more information on the Z transform see http://en.wikipedia.org/wiki/Z-transform
>
> Does anyone know why my code does not work as I would expect/how I can modify it properly. The Goal is to recover f after taking the z transform of the shifted signal, multiplying by the phase shift in the z domain, and then take the inverse z transform to recover the signal f
>
>
> syms a n w k delay;
> f = sin(a*n) +1i*sin(a*n);
> F=ztrans(f, w)
>
> h = sin(a*(n-delay)) +1i*sin(a*(n-delay));
>
> iztrans(F)
>
> H=ztrans(h, k)
>
> zphaseshift=w^(delay);
>
> H=zphaseshift.*H;
>
> f_recover_via_time_shift = iztrans(H)

Hi, Here is an easy example to check (easy to do on paper since you're doing a symbolic calculation)

syms a n z;
x=a^n*heaviside(n);
ztrans(x, z)
y=a^(n-2)*heaviside(n-2);
ztrans(y,z)
% compare ztrans(y,z) to
z^(-2)*ztrans(x,z) % Y(Z)=Z^{-2} X(Z)

Hope that helps,
Wayne
From: omegayen on
"Wayne King" <wmkingty(a)gmail.com> wrote in message <hth5iq$7av$1(a)fred.mathworks.com>...
> "omegayen " <omegayen(a)ameritech.net> wrote in message <hth0jg$1ef$1(a)fred.mathworks.com>...
> > I am trying to verify the Z transform in MATLAB via the timeshift property.
> >
> > For more information on the Z transform see http://en.wikipedia.org/wiki/Z-transform
> >
> > Does anyone know why my code does not work as I would expect/how I can modify it properly. The Goal is to recover f after taking the z transform of the shifted signal, multiplying by the phase shift in the z domain, and then take the inverse z transform to recover the signal f
> >
> >
> > syms a n w k delay;
> > f = sin(a*n) +1i*sin(a*n);
> > F=ztrans(f, w)
> >
> > h = sin(a*(n-delay)) +1i*sin(a*(n-delay));
> >
> > iztrans(F)
> >
> > H=ztrans(h, k)
> >
> > zphaseshift=w^(delay);
> >
> > H=zphaseshift.*H;
> >
> > f_recover_via_time_shift = iztrans(H)
>
> Hi, Here is an easy example to check (easy to do on paper since you're doing a symbolic calculation)
>
> syms a n z;
> x=a^n*heaviside(n);
> ztrans(x, z)
> y=a^(n-2)*heaviside(n-2);
> ztrans(y,z)
> % compare ztrans(y,z) to
> z^(-2)*ztrans(x,z) % Y(Z)=Z^{-2} X(Z)
>
> Hope that helps,
> Wayne

It does help Wayne but I was hoping to also take it further by doing the inverse z transform, hence taking it the final step....

syms a n z;
x=a^n*heaviside(n);
X=ztrans(x, z)
y=a^(n-2)*heaviside(n-2);

% compare ztrans(y,z) to
X1=z^(2)*ztrans(y,z) % Y(Z)=Z^{-2} X(Z)

%x1 and x2 should be equal
x1=iztrans(X)
x2=iztrans(X1)

This works as expected... i was though hoping to see this happen with some other function such as a sine or a cosine

syms a n z;
x= cos(a*n) +1i*sin(a*n);
X=ztrans(x, z)
y=cos(a*(n-2)) +1i*sin(a*(n-2));
Y=ztrans(y,z)
% compare ztrans(y,z) to
X1=z^(2)*ztrans(x,z) % Y(Z)=Z^{-2} X(Z)

x1=iztrans(X)

x2=iztrans(X1)

but in this case x2 is not fully evaluated, does anyone know why this is the case thanks.