Professional Documents
Culture Documents
clc
clear all;
close all;
%1
plot(time,Velocity)
xlabel('time (s)')
ylabel('Velocity (m/s)')
grid on
title('time vs velocity')
figure
%2
v_2 = polyval(p_2,time)';
v_4 = polyval(p_4,time)';
figure
plot(time,Velocity,time,v_2,time,v_4)
grid on
xlabel('time (s)')
ylabel('Velocity (m/s)')
figure
plot(time,acceleration,time,a_2,time,a_4)
grid on
xlabel('time (s)')
ylabel('acceleration (m/s)')
%%
% 3.1
clc
clear all;
close all;
SID=[5,4,3,2,1,6,7]
T1=mean(SID)
T2=T1/5
phi1=deg2rad(sum(SID))
phi2=pi
t=0:0.01:3*T1
A=sum(SID)
B=A/6
for i=1:length(t)
y1(i)=A*sin((2*pi/T1)*t(i)-phi1);
y2(i)=B*cos((2*pi/T2)*t(i)+phi2);
y(i)=y1(i)-y2(i);
end
figure
plot(t,y1)
grid on
xlabel('time (s)')
ylabel('y1(t)')
figure
plot(t,y2)
grid on
xlabel('time (s)')
ylabel('y2(t)')
figure
plot(t,y)
grid on
xlabel('time (s)')
ylabel('y(t)')
% 3.2
for i=1:length(t)
else
c(i)=0;
end
end
figure
plot(t,y,t,y1,t,y2,t,c)
legend('y(t)','y1(t)','y2(t)','c(t)')
grid on
xlabel('time (s)')
ylabel('y(t), y1(t), y2(t), c(t)')
Results:
Part-B
2.1
Y (s)
Closed loop transfer function=
X (s)
So
G(s)=K . G1 ( s ) .G 1 ( s )
G( s)=K
( 2
1
s +2 s +3 )( 2
1
s + 4 s +5 )
Y (s) G(s)
Closed looptransfer function= =
X (s) 1+G (s) H (s)
Y ( s) G(s )
T (s )= =
X (s) 1+G(s)
T (s )=
Y ( s)
=
( s + 2 s+3 s + 4 s+5 )
K
1
2 )( 1
2
( s +21s +3 )( s +41s +5 )
X (s)
1+ K 2 2
Y ( s) K
T (s )= =
X (s) (s ¿¿ 2+2 s+ 3)(s 2+ 4 s+5)+ K ¿
Y (s) K
T (s )= =
X ( s) s 4 +4 s 3+5 s2 +2 s 3 +8 s 2 +10 s+ 3 s 2+12 s +15+ K
The closed loop transfer function for the system is given as,
Y ( s) K
T (s )= =
X (s) s 4 +6 s 3 +16 s 2+ 22 s+15+ K
2.2
4 3 2
s + 6 s + 16 s + 22 s+15+ K =0
Applying RH criteria,
s4 1 16 15+K
s
3
6 22 0
s2 96−22 15+K 0
=12.33
6
s1 181.26−6 K 0
12.33
s0 15+K 0
181.26−6 K
>0∧15+ K >0
12.33
K <30.212∧K >−15
2.3
2.4
K=-20(unstble)