CT Labmanual
CT Labmanual
FREQUENCY RESPONSE
Theory:
The frequency response of any system gives information about variation in system gain in terms
of operating frequency. In electronics circuit, most of the component are sensitive in terms of
frequency so this graph gives the characteristic of electronics system. Some systems may
amplify components of certain frequencies, and attenuate components of other frequencies.
The way that the system output is related to the system input for different frequencies is called
the frequency response of the system.The frequency response is the relationship between the
system input and output in the Fourier Domain as shown in Fig. 1.
In this system, X(jω) is the system input, Y(jω) is the system output, and H(jω) is the frequency
response. We can define the relationship between these functions as:
H(jω) =Y(jω) /X(jω).
mscanf: reads input from the standard input (interface to the C scanf function )
The mscanf function reads characters from Scilab window.
Sample Program:
clc;
c=.1*10^-6;
r=1000;
f=0:100:2000;
for i=1:length(f);
H=1/sqrt(1+(2*%pi*f(i)*r*c)^2);
Hd(i)=20*log10(H);
end
xgrid(3,1,50);
xlabel('frequency in HZ');
ylabel('gain in dB');
plot(f,Hd);
Simulation results
ADD DETAILS IN GRAPH IF POSSIBLE. ex. Datatip
Assignment Program:
1) Make the above program generalized in terms of user defined frequency range and cut-off
frequency and plot the frequency response. Also display cutoff frequency in console and graph.
2) Modify the program for different order of low pass filter and plot its frequency response.
Conclusion:
EXPERIMENT 2
ROUTH METHOD
Theory:
Routh methods used for finding the stability of any system. In this method, we generate the
routh array. In this routh array all the vaules in the first column are positive then the system is
stable. If any one value from the first column of the routh array is negative then the system is
unstable. In this case, we find how many time change in sign in the first column. This number is
same as a number of the pole in right-hand side plan which is responsible for instability.
Sample Program:
clc;
clear;
s=%s;
p=(s^4+8*s^3+18*s^2+16*s+5);
r=routh_t(p);
z=r(:,1);
m=length(z);
f=0;
for i=1:m
if z(i)<0 then
disp("entered equation is UNSTABLE");
f=1;
break;
end
end
if f==0 then
disp("entered equation is STABLE")
end
c=0;
for i=1:m-1
if ((z(i)<0&z(i+1)>0)|(z(i)>0&z(i+1)<0)) then
c=c+1;
end
end
disp(p);
disp("number of pole which is in right hand side is :");
disp(c);
disp("routh array:");
disp(r);
disp("roots of polynomial:");
f=roots(p);
disp(f);
Simulation results:
Generalized form of above program which include user define system characteristic Equation
and it gives number of pole which is in right hand side and give roots of the equation.
Assignment Program 2:
Write the programme code for check the stability for the following two special cases of control
system:
Case i: The routh array have any one values in first column is zero.
Case ii: The entire one row in the routh array is zero.
Conclusion:
EXPERIMENT 3
HURWITZ METHOD
Theory:
Hurwitz method is also used for finding the stability of any system. In this method, we generate
one matrix by given characteristic equation then we generate another m x m matrix where m is
the highest degree of characteristic Equation. After finding the matrix we find their determinant if
all determinant’s value is positive then the system is stable.
det: determinant
det(X)
Sample Program :
clc;
clear;
close;
s=%s;
a=input("enter coefficient ");
m=length(a);
p=0;
for i=1:m
p=p+a(i)*s^(m-i);
end
r=coeff(p);
disp(p);
D1=r(4);
d2=[r(4) r(5);r(2) r(3)]
D2=det(d2);
d3=[r(4) r(5) 0;r(2) r(3) r(4);0 r(1) r(2)]
D3=det(d3);
d4=[r(4) r(5) 0 0;r(2) r(3) r(4) r(5); 0 r(1) r(2) r(3); 0 0 0 r(1)]
D4=det(d4);
disp(D1,"D1=");
disp(D2,"D2=");
disp(D3,"D3=");
disp(D4,"D4=");
if(D1&D2&D3&D4>=0)
printf("entered equation is STABLE");
else
printf("entered equation is UNSTABLE");
end
Simulation results:
Generalized form of above program which includes user define system for different polynomial
equations.
Assignment Program 2:
Generalized form of Hurwitz method for system stability using object oriented programming in
C/C++.
Conclusion:
EXPERIMENT 4
BODE PLOT
Objective: Plot magnitude and phase response using bode plot for control systems.
Theory:
Sample Program:
clear;
clc;
clf;
s=%s;
x=syslin('c',((10)/(s*(1+(0.5*s))*(1+(0.01*s)))));
bode(x,1e-1,1e+3);
disp("system equation is:")
disp(x);
[gm,wpc]=g_margin(x);
disp("gain margin is:");
disp(gm);
disp("phase crossover freq. is:");
disp(wpc);
[pm,wgc]=p_margin(x);
disp("phase margin is:");
disp(pm);
disp("gain crossover freq. is:");
disp(wgc);
if wgc<wpc then
if gm>0 & pm>0 then
disp("this system is stable");
end
end
if wgc>wpc then
if gm<0 | pm<0 then
disp("this system is unstable");
end
end
if wgc>=wpc then
if gm==0 & pm==0 then
disp("this system is conditionaly stable");
end
end
Simulation results:
Graph:
Conclusion: