cs2
cs2
1. Implement Block diagram reduction technique to obtain transfer function a control system.
close all;
clear
P=4
Q=[1 1 2]
A=tf (P,Q)
R=[1 0]
S= [1 2]
B= tf (R , S)
C= series (A,B)
Ans =
4s
---------------------
s^3 + 3 s^2 + 8 s + 4
P a g e 1 | 22
Control System IPCC Laboratory (BEC403) 2024-25
P a g e 2 | 22
Control System IPCC Laboratory (BEC403) 2024-25
clear
P=4
Q=[1 1 2]
A=tf (P,Q)
R=[1 0]
S= [1 2]
B= tf (R , S)
C= series (A,B)
Ans =
4s
---------------------
s^3 + 3 s^2 + 8 s + 4
P a g e 3 | 22
Control System IPCC Laboratory (BEC403) 2024-25
3. Simulation of poles and zeros of a transfer function.
num/den =
6s+1
-------
s+5
num=[6,1];
den=[1, 5];
sys=tf(num,den);
printsys(num,den);
[Z,P]=tf2zp(num,den)
pzmap(P,Z)
P a g e 4 | 22
Control System IPCC Laboratory (BEC403) 2024-25
4) Determination of time response specification of a second order under damped System, for different damping
factors.
% Given System
wn = 10; % Natural Frequency
zeta = [0.1 0.3 0.5 0.7 0.9]; % Damping Ratio
% Display Results
fprintf('Damping Ratio = %.1f\n', zeta(i));
fprintf('Damped Natural Frequency = %.2f rad/s\n', wd);
fprintf('Rise Time = %.2f s\n', tr);
fprintf('Settling Time = %.2f s\n', ts);
fprintf('Percent Overshoot = %.2f %%\n\n', Mp*100);
end
Result:
P a g e 5 | 22
Control System IPCC Laboratory (BEC403) 2024-25
Rise Time = 0.42 s
Note that program calculates the time response specification of a second-order underdamped system for
different damping ratios. The program first defines the natural frequency and damping ratio of the system.
Then, it calculates the damped natural frequency, rise time, settling time, and percent overshoot for each
damping ratio using the formulas:
P a g e 6 | 22
Control System IPCC Laboratory (BEC403) 2024-25
5) Determination of frequency response of a second order System
% Second-Order System Frequency Response Example
% Given System
wn = 10; % Natural Frequency
zeta = 0.5; % Damping Ratio
subplot(2,1,2);
semilogx(w, phase2d);
grid on;
title('Phase Response');
xlabel('Frequency (rad/s)');
ylabel('Phase (deg)');
P a g e 7 | 22
Control System IPCC Laboratory (BEC403) 2024-25
6) Determination of frequency response of a lead lag compensator
P a g e 8 | 22
Control System IPCC Laboratory (BEC403) 2024-25
P a g e 9 | 22
Control System IPCC Laboratory (BEC403) 2024-25
7.Analyze the stability of the given system using Routh stability criterion.
P a g e 10 | 22
Control System IPCC Laboratory (BEC403) 2024-25
P a g e 11 | 22
Control System IPCC Laboratory (BEC403) 2024-25
8) Using suitable simulation package, draw Root locus of the given transfer function.
Here transfer function `sys` using the numerator and denominator coefficients. We then use the `rlocus` function to
plot the root locus of the system and the `bode` function to plot the Bode plot of the system.
P a g e 12 | 22
Control System IPCC Laboratory (BEC403) 2024-25
9) Using suitable simulation package, draw Bode plot of the given transfer function.
Here transfer function `sys` using the numerator and denominator coefficients. We then use the `rlocus` function to
plot the root locus of the system and the `bode` function to plot the Bode plot of the system.
% Bode Plot
figure;
bode(sys);
grid on;
title('Bode Plot');
P a g e 13 | 22
Control System IPCC Laboratory (BEC403) 2024-25
10) Using suitable simulation package, draw Nyquist plot of the given transfer function.
Here transfer function `sys` using the numerator and denominator coefficients. We then use the `rlocus` function to
plot the root locus of the system and the `bode` function to plot the Bode plot of the system.
% Nyquist Plot
figure;
nyquist(sys);
grid on;
title('NyquistPlot');
P a g e 14 | 22
Control System IPCC Laboratory (BEC403) 2024-25
11) Using suitable simulation package, obtain the time response from state model of a system.
In this example, we define a state model `sys` using the state-space matrices `A`, `B`, `C`, and `D`.
We then define an input signal `u` and a time vector `t` for simulation. We use the `lsim` function to
simulate the system response to the input signal and obtain the output `y`, time vector `t`, and state
vector `x`. Finally, we plot the system response over time using the `plot` function.
P a g e 15 | 22
Control System IPCC Laboratory (BEC403) 2024-25
PI Controllers:
In this example, we define a transfer function `G` for the given system. We then define the parameters `Kp` and `Ki`
for the PI controller and calculate the transfer function `C`. We use the `feedback` function to obtain the closed-loop
system transfer function `sys`. Finally, we plot the step response of the closed-loop system using the `step` function.
% Given System
s = tf('s');
G = 1/(s*(s+1));
% PI Controller Parameters
Kp = 1;
Ki = 1;
% Step Response
step(sys);
grid on;
title('Step Response with PI Controller');
P a g e 16 | 22
Control System IPCC Laboratory (BEC403) 2024-25
PD Controller:
In this example, we define a transfer function `G` for the given system. We then define the parameters `Kp`
and `Kd` for the PD controller and calculate the transfer function `C`. We use the `feedback` function to
obtain the closed-loop system transfer function `sys`. Finally, we plot the step response of the closed-loop
system using the `step` function.
% Given System
s = tf('s');
G = 1/(s*(s+1));
% PD Controller Parameters
Kp = 1;
Kd = 1;
% Step Response
step(sys);
grid on;
title('Step Response with PD Controller');
P a g e 17 | 22
Control System IPCC Laboratory (BEC403) 2024-25
In this example, we define a plant transfer function `G` and a PID controller transfer function `C`. We then use the
`feedback` function to define the closed-loop transfer function `T`. We simulate the closed-loop system using the
`lsim` function and plot the input and output signals. Finally, we calculate and plot the error signal `e` by subtracting
the output signal from the input signal.
P a g e 18 | 22
Control System IPCC Laboratory (BEC403) 2024-25
P a g e 19 | 22
Control System IPCC Laboratory (BEC403) 2024-25
14) Demonstrate the effect of PI, PD and PID controller on the system response.
In this example, a plant transfer function `G` and an input signal `r`. We then define the PI, PD, and PID controller
transfer functions `C_pi`, `C_pd`, and `C_pid`, respectively. We use the `feedback` function to define the closed-loop
transfer functions `T_pi`, `T_pd`, and `T_pid`. We simulate the closed-loop systems with each controller using the
`lsim` function and plot the results.
Modify can be done on the controller gains and plant transfer function to observe the effect of different controller
configurations on the system response
subplot(2,2,2);
P a g e 20 | 22
Control System IPCC Laboratory (BEC403) 2024-25
plot(t, r, 'b', t, y_pd, 'r');
xlabel('Time (s)');
ylabel('Amplitude');
title('PD Controller');
legend('Input', 'Output');
subplot(2,2,3);
plot(t, r, 'b', t, y_pid, 'r');
xlabel('Time (s)');
ylabel('Amplitude');
title('PID Controller');
legend('Input', 'Output');
P a g e 21 | 22
Control System IPCC Laboratory (BEC403) 2024-25
VIVA-VOCE QUESTIONS
P a g e 22 | 22