CS 3 Doc

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

PROGRAM OUTPUT

1. p=[0 -1 -2]; 1.2


unit step response

k=1;
z=[]; 1
T=0:0.01:20;
G=zpk(z,p,k); 0.8
sys=feedback(G,1);
response=step(sys,T);

output
0.6
plot(response)
grid on;
0.4
xlabel('time');
ylabel('output');
title('unit step response') 0.2

0
0 500 1000 1500 2000 2500
time
2. p=[0 -1 -2]; 1.2
z on negative real axis
k=-(1./z); z=-1
z=[-1 -5 10]; 1
z=-5
T=0:0.01:40; z=10

for i=1:length(z) 0.8


G=zpk(z(i),p,k(i));
sys=feedback(G,1); 0.6
response=step(sys,T); output
plot(response) 0.4
grid on;
hold on; 0.2
end
xlabel('time'); 0
ylabel('output');
legend('z=-1','z=-5','z=10') -0.2
title('z on negative real axis') 0 500 1000 1500 2000 2500 3000 3500 4000 4500
time

p=[0 -1 -2]; z on negative real axis


3. 1.4
k=-(p); p=0
z=[]; 1.2
p=-1
p=-2
T=0:0.01:20;
for i=1:length(p) 1
G=zpk(z,p,k(i));
sys=feedback(G,1); 0.8
output

response=step(sys,T);
plot(response) 0.6
grid on;
hold on; 0.4
end
xlabel('time');ylabel('output'); 0.2
legend('p=0','p=-1','p=-2')
title('z on negative real axis') 0
0 500 1000 1500 2000 2500
time
4. s=tf('s'); Step Response
1.4
td=[0.1 0.3 0.5 0.7];
td=0.1
for i=1:length(td) 1.2 td=0.3
g1= exp(-td(i)*s); td=0.5
td=0.7
g2= tf([1],[1 3 2 0]); 1

G=g1*g2; 0.8
sys=feedback(G,1);
Amplitude

hold on; 0.6


step(sys)
0.4
grid on;
end 0.2
xlabel('time'); ylabel('Amplitude');
legend('td=0.1','td=0.3','td=0.5', 0

'td=0.7')
-0.2
title('Step Response') 0 5 10 15 20 25 30 35
time (seconds)

You might also like