Cs Lab Expts
Cs Lab Expts
4) Determination of time response specification of a second order under damped System, fordifferent
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:
1
Control System lab IPCC Laboratory
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:
2
Control System lab IPCC Laboratory
5) Determination of frequency response of a second order System
% Second-Order
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)');
3
Control System lab IPCC Laboratory
% Lead-Lag
Lag Compensator Frequency Response Example
% Given System
K = 1; % Gain
wn = 10; % Natural Frequency
zeta = 0.5; % Damping Ratio
M = 10; % DC Gain
alpha = 0.1; % Lag Ratio
beta = 10; % Lead Ratio
4
Control System lab IPCC Laboratory
8) Using suitable simulation package, draw Root locus & 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');
5
Control System lab IPCC Laboratory
9) 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.
6
Control System lab IPCC Laboratory
10) Implementation of PI, PD Controllers.
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');
7
Control System lab IPCC Laboratory
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
loop system transfer function `sys`. Fin
Finally,
ally, we plot the step response of the
closed-loop
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');
8
Control System lab IPCC Laboratory
11) Implement a PID Controller and hence realize an Error Detector.
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.
9
Control System lab IPCC Laboratory
10
Control System lab IPCC Laboratory
12) 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);
11
Control System lab IPCC Laboratory
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');
12