CSE 432 Spring 2019 Lab 10

April 10, 2019

Task: Pole Zero, Roots, Poly, ZPKdata and PZ map of System

clc; close all; clear all;
num=[10 20 30];
den=[40 50 60];
sys=tf(num,den);
poles=pole(sys)
zeros=zero(sys)

poles_using_roots=roots(den)
zeros_using_roots=roots(num)

den_using_poly=poly(poles)
num_using_poly=poly(zeros)

[z,p,k]=zpkdata(sys,'v')
pzmap(sys)

Pole zero plot after laplace transform

%Laplace Transform
close all; clear; clc;
syms t s;

ft=5*t^2+ 3*t+9;
fs=laplace(ft);
pretty(fs);
fw=fourier(ft);
pretty(fw);
ffs=simplify(fs);
pretty(ffs)
[n,d] = numden(ffs);
n=sym2poly(n);
d=sym2poly(d);
pzmap(tf(n,d))

Task: Z-transform and Inverse Z-transform

Code

clc; close all; clear all;
syms w n z;
ztransformed=ztrans(sin(w*n))
Inverse_ztransformed=simplify(iztrans(ztransformed,n))

Output:

ztransformed =
 (z*sin(w))/(z^2 - 2*cos(w)*z + 1)
Inverse_ztransformed =
 sin(n*w)

Task: finding the impulse and step response of the LTI system by difference equation

Code

clc; close all; clear all;
use step() and impulse() function
Code to be done by students

Task: Finding Transfer function of a system

Code

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;

H2=H2/G4;
t1= series(G3,G4);
t2= feedback(t1,H1,+1);
t3= series(t2,G2);
t4= feedback(t3,H2,-1);
t5= series( t4,G1);
t= feedback(t5,H3,-1)

 

Output:

Transfer function:
s^5 + 4 s^4 + 6 s^3 + 6 s^2 + 5 s + 2
----------------------------------------------------------------
12 s^6 + 205 s^5 + 1066 s^4 + 2517 s^3 + 3128 s^2 + 2196 s + 712

 

Task : Cross Corelation

Code

clc; close all; clear all;
a = input('Coefficients of x: ');
b = input('Coefficients of y: ');
Cross=xcorr(a,b)
Subplot 311
stem(a); axis([-2  10 -5 10]);
subplot 312
stem(b); axis([-2  10 -5 10]);
subplot 313
stem(Cross); axis([-2  10 -17 70])

 

Output:

Coefficients of x: [1 2 3 4]
Coefficients of y: [9 8 7 6]
Cross =
6.0000   19.0000   40.0000   70.0000   70.0000   59.0000   36.0000

Task: Auto Correlation

Code

clc; close all; clear all;
a = input('Coefficients of x: ');
auto=xcorr(a,a)
subplot 211
stem(a);
subplot 212
stem(auto);

Output:

Coefficients of x: [1 2 3 4]
auto =
4.0000   11.0000   20.0000   30.0000   20.0000   11.0000    4.0000

No homework.

Print Friendly, PDF & Email

Leave a Reply