# CSE 432 Fall 2019 Lab 10

Z-transform and Inverse Z-transform

```%Lab 10 Task 1
close all
clear
clc

syms f f2 w n;
f=sin(w*n);
zTransformed=ztrans(f);
pretty(zTransformed)
pretty(iztrans(zTransformed))

f2=cos(w*n);
zTransformed2=ztrans(f2);
pretty(zTransformed2)
pretty(iztrans(zTransformed2))```

Cross Correlation

```%Lab 10 Task 2
close all
clear
clc

a=[2 -1 3 7 1 2 -3];
b=[1 -1 2 -2 4 1 -2 5];
c=xcorr(a,b);
disp(c);

figure
subplot 311
stem(a)
title('Signal 1')
ylabel('a')
subplot 312
stem(b)
title('Signal 2')
ylabel('b')
subplot 313
stem(c)
title('Cross Correlation of signal 1 and 2')
ylabel('c')```

Auto Correlation

```%Lab 10 Task 3
close all
clear
clc

a=[2 -1 3 7 1 2 -3];
c=xcorr(a,a);
disp(c);

figure
subplot 211
stem(a)
title('Signal 1')
ylabel('a')
subplot 212
stem(c)
title('Auto Correlation of signal 1 ')
ylabel('c')```

Finding Transfer function of a system

```%Lab 10 Task 4
close all
clear
clc

s=tf('s');
g1=1/(s+10);
g2=1/(s+1);
g3=(s^2+1)/(s^2+4*s+4);
g4=(s+1)/(s+6);
h1=(s+1)/(s+2);
h2=2;
h3=1;

t1=series(g3,g4);
t2=feedback(t1,h1,+1);
t3=series(t2,g2);
h2=h2/g4;
t4=feedback(t3,h2,-1);
t5=series(t4,g1);
t6=feedback(t5,h3,-1);```

Pole, Zero, Roots, Poly, ZPKdata and PZ map of a system. Pole zero plot of a system after Laplace Transform.

```%Lab 10 Task 5
close all
clear
clc

syms t s;

ft=5*t^2+3*t+9;
fs=laplace(ft);
fw=fourier(ft);
pretty(ft)
pretty(fs)
%pretty(fw)
fs=simplify(fs);
pretty(fs)

[n,d]=numden(fs);
n=sym2poly(n);
d=sym2poly(d);
poles=roots(d)
zeroes=roots(n)

[p,z]=pzmap(tf(n,d));
pzmap(tf(n,d));

sys=tf(n,d);
sys
pole(sys)
zero(sys)```