Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

1.

clc;
clear all;
x=0:0.1:10;
y1=sin(2*x);
subplot(2,2,1)
plot(x,y1)
title('sin(2t)')
grid on
y2=cos(2*x);
subplot(2,2,2)
plot(x,y2)
title('cos(2t)')
grid on
y3=sin(4*x+pi/2)
subplot(2,2,3)
plot(x,y3)
title('sin(4t+pi/2)')
grid on
y4=cos(4*x+(pi/2))
subplot(2,2,4)
plot(x,y4)
title('cos(4t+pi/2)')
grid on
2.
clc;
clear all;
num=[2 3];
den=[1 0.4 1];
tf=filt(num,den)
[z,p,k]=zpkdata(tf)

SOLUTION

sys =

2 + 3 z^-1
-------------------
1 + 0.4 z^-1 + z^-2

Sample time: unspecified


Discrete-time transfer function.

z =

[0;-1.5]

p =

[-0.2 + 0.979795897113271i;-0.2 - 0.979795897113271i]

k =

2
3.
clc;
clear all;
num=[1];
den=[1 1];
sys=tf(num,den,'inputdelay',1.5)
sysd=c2d(sys,1)
[z p k]=zpkdata(sysd)

SOLUTION-

sys =

exp(-1.5*s) * -----

s+1

Continuous-time transfer function.

sysd =

0.3935 z + 0.2387

z^(-2) * -----------------

z - 0.3679

Sample time: 1 seconds

Discrete-time transfer function.

z=

[-0.6065]

p=

[0.3679]

k=

0.3935
4.
clc;
clear all;
num=[5 5];
den=[1 2 2];
t=tf(num,den)
sys=feedback(t,1)
k1=c2d(sys,1,'zoh')
subplot(2,2,1);
step(k1)
title('ts=1s')
grid on
k2=c2d(sys,0.5,'zoh')
subplot(2,2,2);
step(k2)
title('ts=0.5s')
grid on
k3=c2d(sys,0.3,'zoh')
subplot(2,2,3);
step(k3)
title('ts=0.3')
grid on
k4=c2d(sys,0.05,'zoh')
subplot(2,2,4);
step(k4)
title('ts=0.05')
grid on

SOLUTION
t=

5s+5

-------------

s^2 + 2 s + 2

Continuous-time transfer function.

sys =

5s+5

-------------

s^2 + 7 s + 7

Continuous-time transfer function.


k1 =

0.7678 z - 0.2683

--------------------------

z^2 - 0.3016 z + 0.0009119

Sample time: 1 seconds

Discrete-time transfer function.

k2 =

0.7673 z - 0.4613

-----------------------

z^2 - 0.6017 z + 0.0302

Sample time: 0.5 seconds

Discrete-time transfer function.

k3 =

0.6865 z - 0.5075

-----------------------

z^2 - 0.8718 z + 0.1225

Sample time: 0.3 seconds

Discrete-time transfer function.

k4 =

0.2159 z - 0.2054

---------------------

z^2 - 1.69 z + 0.7047

Sample time: 0.05 seconds

Discrete-time transfer function.


5.
clc;
clear alL;
num=[1 -5];
den=[1 2 2];
t=tf(num,den,'inputdelay',1)
d1=c2d(t,0.1)
subplot(2,2,1);
step(t,'b',d1,'r')
legend('continuous','discretized')
title('ts=0.1')
grid on
d2=c2d(t,0.025)
subplot(2,2,2);
step(d1,'b',d2,'r')
legend('ts=0.1','ts=0.025')
grid on
6.
SIMULINK MODEL

STEP RESPONSE
1

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
Time
7.

a.
clc;
clear all;
a1=[0 1;-2 -3];
b1=[1;0];
c1=[1 0];
d1=0;
sys1=ss(a1,b1,c1,d1,0.4)
t1=tf(sys1)

SOLUTION
t1 =

z + 3
-------------
z^2 + 3 z + 2

Sample time: 0.4 seconds


Discrete-time transfer function.

b.
a2=[-3 1;-2 0];
b2=[0;1];
c2=[1 0];
d2=0;
sys2=ss(a2,b2,c2,d2,0.4)
t2=tf(sys2)

SOLUTION
t2 =

1
-------------
z^2 + 3 z + 2

Sample time: 0.4 seconds


Discrete-time transfer function.
c.
a3=[2 -1 0;1 1 2;-1 0 1];
b3=[-1 0;1 0;0 2];
c3=[1 1 0;1 0 1];
d3=[0 0;0 0];
sys3=ss(a3,b3,c3,d3,.4)
t3=tf(sys3)

SOLUTION
sys3 =

a =
x1 x2 x3
x1 2 -1 0
x2 1 1 2
x3 -1 0 1

b =
u1 u2
x1 -1 0
x2 1 0
x3 0 2

c =
x1 x2 x3
y1 1 1 0
y2 1 0 1

d =
u1 u2
y1 0 0
y2 0 0

Sample time: 0.4 seconds


Discrete-time state-space model.

t3 =

From input 1 to output...


-3 z + 5
1: ---------------------
z^3 - 4 z^2 + 6 z - 5

-z^2 + 2 z - 4.441e-16
2: ----------------------
z^3 - 4 z^2 + 6 z - 5

From input 2 to output...


4 z - 12
1: ---------------------
z^3 - 4 z^2 + 6 z - 5

2 z^2 - 6 z + 2
2: ---------------------
z^3 - 4 z^2 + 6 z - 5

Sample time: 0.4 seconds


Discrete-time transfer function.
9.
clc
clear all
num=[1 3];
den=[1 3 2];
sys=tf(num,den,.3)
p=ss(sys)

SOLUTION
sys =

z+3

-------------

z^2 + 3 z + 2

Sample time: 0.3 seconds

Discrete-time transfer function.

a=

x1 x2

x1 -3 -2

x2 1 0

b=

u1

x1 2

x2 0

c=

x1 x2

y1 0.5 1.5

d=

u1

y1 0

Sample time: 0.3 seconds

Discrete-time state-space model.


9.B
clc
clear all
num=[1 8 17 8];
den=[1 6 11 6];
sys=tf(num,den,.3)
p=ss(sys)

SOLUTION
sys =

z^3 + 8 z^2 + 17 z + 8

----------------------

z^3 + 6 z^2 + 11 z + 6

Sample time: 0.3 seconds

Discrete-time transfer function.

a=

x1 x2 x3

x1 -6 -2.75 -1.5

x2 4 0 0

x3 0 1 0

b=

u1

x1 2

x2 0

x3 0

c=

x1 x2 x3

y1 1 0.75 0.25

d=

u1

y1 1

Sample time: 0.3 seconds

Discrete-time state-space model……….

You might also like