summaryrefslogtreecommitdiff
path: root/3889/CH2/EX2.4/Ex2_4.sce
blob: 00723546e848ead4c6afc25d69abeb7cd9a86d5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//Example 2.4
//page 63
//Control Systems: Principles and Design 
//M Gopal, Second Edition, Tata McGraw-Hill
//Chapter: Dynamic Models and Dynamic Response


xdel(winsid())//close all graphics Windows
clear;
clc;

// Transfer function
s= %s;
//s=poly(0,'s');
y=1;
r=(s^2) + (3*s) + 2;
//continuous time linear model created
g=syslin('c',y/r);

clf();
t=0:0.5:100;
a=size(t)
u=ones(a(1),a(2));
//step response
y1=csim(u,t,[g*5]);

//ramp response
u2= 5* t;
y2=csim(u2,t,g)

//plot
subplot(211)
plot(t,y1)
m=gca();
m.auto_scale = "off"
m.data_bounds = [0,0;6,6]
plot(t,5*u)
title('Step Response of transfer function','fontsize',3)
xlabel('Time t (sec.)','fontsize',2)
ylabel('Amplitude','fontsize',2)
subplot(212)
plot(t,y2)
m=gca();
m.auto_scale = "off"
m.data_bounds = [0,0;10,10]

plot(t,u2)
title('Ramp Response of transfer function','fontsize',3)
xlabel('Time t (sec.)','fontsize',2)
ylabel('Amplitude','fontsize',2)