0% found this document useful (0 votes)
10 views

Cs Assignment

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Cs Assignment

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

CONTROL SYSTEMS

ASSIGNMENT – I

SUBMITTED BY
CHRISTABEL BENITA S P
(2022105007)
QUESTION 1:

Implement a control algorithm for the system represented by


T(s)=10/S^2+4S+10 using PID controller
Write MATLAB code to design a PID controller for this system.
Simulate the closed-loop response to a step input and discuss the effect
of varying the PID parameters on the system performance.

Matlab code:
% Define the system transfer function T(s) = 10 / (s^2 +
4s + 10)
clc;clear all;close all;
num = 10; % Numerator of the transfer function
den = [1 4 10]; % Denominator of the transfer function
sys = tf(num, den); % Create the transfer function in
MATLAB

% Design a PID controller using pid() function


Kp = 10; % Proportional gain
Ki = 1; % Integral gain
Kd = 1; % Derivative gain
% Create the PID controller
pid_controller = pid(Kp, Ki, Kd);
% Closed-loop system with PID controller
closed_loop_sys = feedback(pid_controller * sys, 1);
% Simulate the closed-loop response to a step input
t = 0:0.01:3; % Time vector from 0 to 10 seconds
step_response = step(closed_loop_sys, t);
% Plot the step response
figure;
plot(t, step_response);
title('Closed-loop Step Response with PID Controller');
xlabel('Time (seconds)');
ylabel('Amplitude (V)');
grid on;
% Display the PID parameters and closed-loop system
performance
info = stepinfo(closed_loop_sys);
disp('Step Response Information:');
disp(info);

%% Varying PID Parameters and Observing System Performance


% Example: Increase Proportional Gain (Kp)
Kp2 = 50;
pid_controller2 = pid(Kp2, Ki, Kd);
closed_loop_sys2 = feedback(pid_controller2 * sys, 1);
step_response2 = step(closed_loop_sys2, t);
% Example: Increase Derivative Gain (Kd)
Kd2 = 10;
pid_controller3 = pid(Kp, Ki, Kd2);
closed_loop_sys3 = feedback(pid_controller3 * sys, 1);
step_response3 = step(closed_loop_sys3, t);
% Example: Increase Integral Gain (Ki)
Ki2 = 10;
pid_controller4 = pid(Kp, Ki2, Kd);
closed_loop_sys4 = feedback(pid_controller4 * sys, 1);
step_response4 = step(closed_loop_sys4, t);
% Plot the step responses with varying PID parameters
figure;
plot(t,step_response2,'r');
hold on;
plot(t,step_response3,'k');
hold on;
plot(t,step_response4,'b');
title('Step response with varied PID parameters');
legend('Increased Kp','Increased Kd','Increased Ki')
xlabel('Time (seconds)');
ylabel('Amplitude (V)');
grid on;
Output:
Inference:
• Higher Kp reduces rise time but can introduce overshoot.
• Higher Ki corrects steady-state errors, though it may increase
overshoot and cause sustained oscillations if too high.
• Higher Kd improves stability by damping oscillations, but if excessive,
it can make the response sluggish and sensitive to noise.
These observations highlight the need for balanced tuning in PID control.

QUESTION 2

Given the transfer function T(s)=5/S^2+4S+5.Analyze the step response of


the system. Use MATLAB to plot the step response and determine the rise time,
settling time, and overshoot. Discuss the significance of these parameters in
relation to transient response.

Matlab code:
% Define the system transfer function T(s) = 5 / (s^2 + 4s
+ 5)
num = 5; % Numerator of the transfer function
den = [1 4 5]; % Denominator of the transfer function
sys = tf(num, den); % Create the transfer function in MATLAB
% Step response of the system
t = 0:0.01:10; % Time vector from 0 to 10 seconds
step_response = step(sys, t);
% Plot the step response
figure;
plot(t, step_response, 'k');
title('Step Response of the System T(s) = 5 / (s^2 + 4s +
5)',’Fontsize’,30);
xlabel('Time (seconds)');
ylabel('Amplitude (V)');
grid on;
% Analyze the step response to get rise time, settling time,
and overshoot
info = stepinfo(sys);
% Display the step response information
disp('Step Response Information:');
disp(info);

Output:
Inference:
Rise Time: The system's rise time (around 1.27 seconds) suggests that it reaches
a significant portion of its final value relatively quickly. This indicates that the
system is responsive and can react promptly to sudden changes.
Overshoot (~18.6%): This system has a slight overshoot, which is typical of an
underdamped second-order system.
Settling Time (~1 sec): The system stabilizes fairly quickly. A faster settling time
means the system reaches a steady state more efficiently, which is a positive
attribute for applications requiring stability and minimal sustained oscillations
after a disturbance.
Based on its overshoot and oscillatory response, this system can be classified as
underdamped. Such systems are usually preferred when a balance between
responsiveness and overshoot is needed, as the overshoot is manageable and the
response is quick.

You might also like