Lab - 06 56
Lab - 06 56
Lab - 06 56
The transfer function (input-output relationship) for this control system is defined as
Where:
K is the DC Gain (DC gain of the system ratio between the input signal and the
steady-state value of output)
T is the time constant of the system (the time constant is a measure of how quickly a
first-order system responds to a unit step input)
Remember that the order of a differential equation is the order of the highest order derivat ive
present in the equation. Evaluate this with respect to (s).
Since here is to the first power (𝑠 1 = 𝑠), the transfer function above is a first-order
differential equation. Hence the block diagram above represents a first-order control
system.
In a theoretical alternate example, let us say that the transfer function was equal to:
In this example since is to the second power (𝑠 2 ), the transfer function is a second-order
differential equation. Hence a control system with the above transfer function would be a
second-order control system.
Most of the practical models are first-order systems. If a system with higher-order has a
dominant first-order mode it can be considered as a first-order system.
Engineers try to find out techniques for systems to become more efficient and reliable. There
are two methods of controlling the systems. One is an open-loop control system, and another
is a closed-loop feedback control system.
In an open-loop system, the inputs proceed to the given process and produce output. There is
no feedback back into the system as for the system to ‘know’ how close the actual output is to
the desired output comes.
In a closed-loop control system, the system has the ability to check how far the actual output
deviates from the desired output (as the time approaches infinity, this difference is known as
the steady state error). It passes this difference as feedback to the controller who controls the
system. The controller will adjust its control of the system based on this feedback.
If the input is a unit step, the output is a step response. The step response yields a clear vision
of the system’s transient response. We have two types of systems, first-order system, and
second-order system, which are representative of many physical systems.
The first order of the system is defined as the first derivative with respect to time and the
second-order of the system is the second derivative with respect to time.
A first-order system is a system that has one integrator. As the number of orders increases,
the number of integrators in a system also increases. Mathematically, it is the first derivative
of a given function with respect to time.
The forced response is also called the steady-state response or a particular equation. The
natural response is also called the homogeneous equation.
Before proceeding to this topic, you should be aware of the control engineering concepts of
poles, zeros, and transfer function and fundamental concepts of the feedback control systems.
Here, remind your memory with fundamental concepts of the feedback control system.
3.6.8 Second-Order System
The second-order system is unique in this context, because its characteristic equation may
have complex conjugate roots. The second-order system is the lowest-order system capable
of an oscillatory response to a step input. Typical examples are the spring-mass-damper
system and the electronic RLC circuit. Second-order systems with potential oscillatory
responses require two different and independent types of energy storage, such as the inductor
and the capacitor in RLC filters, or a spring and an inert mass. The transfer function of the
general second-order system has two poles in one of three configurations: both poles can be
real-valued and on the negative real axis, they can form a double-pole on the negative real
axis, or they can form a complex conjugate pole pair. The significance of the pole position of
a second-order system is examined in Section 3.3 and in more detail in Chapter 9.
The unit step response depends on the roots of the characteristic equation. If both roots are
real-valued, the second-order system behaves like a chain of two first-order systems, and the
step response has two exponential components. If the roots are complex, the step response is
a harmonic oscillation with an exponentially decaying amplitude.
Consider a second-order system as follows:
The second-order system is unique in this context, because its characteristic equation may
have complex conjugate roots. The second-order system is the lowest-order system capable
of an oscillatory response to a step input. Typical examples are the spring-mass-damper
system and the electronic RLC circuit. Second-order systems with potential oscillatory
responses require two different and independent types of energy storage, such as the inductor
and the capacitor in RLC filters, or a spring and an inert mass. The transfer function of the
general second-order system has two poles in one of three configurations: both poles can be
real-valued, and on the negative real axis, they can form a double-pole on the negative real
axis, or they can form a complex conjugate pole pair.
Example part a
% Define the transfer function G(s)
num = 2;
den = [1 2.5];
G = tf(num, den);
time_constant = 1 / abs(pole(G));
settling_time = 4 / (real(pole(G)));
dc_gain = dcgain(G);
t = 0:0.01:10;
peak_time = t(peak_index);
Example part 2
% Define the transfer function G(s)
num = 6;
den = [1 1 8];
G = tf(num, den);
time_constant = 1 / abs(pole(G));
settling_time = 4 / (real(pole(G)));
dc_gain = dcgain(G);
t = 0:0.01:20;
peak_time = t(peak_index);
Exercise 01 part a
% Define the transfer function G(s)
num = 100;
H = 1;
step_error = 1 / (1 + dcgain(G));
G = tf(num, den);
[y, t] = step(sys);
peak_amplitude = max(y);
dc_gain = dcgain(sys);
Exersice 2 part a
% Define the transfer function G(s)
K = 40;
num = K;
den = conv([1 0], [1 14]); % Convolution of s and (s+14)
G = tf(num, den);
u = ones(size(t));
dc_gain = dcgain(sys);
[peak_amplitude, ~] = max(y);
percent_overshoot = ((peak_amplitude - dc_gain) / dc_gain) * 100;
plot(t, y);
title('Step Response');
xlabel('Time');
ylabel('Output');
grid on;
Exersice 2 part b
% Define the transfer function G(s)
num = [1];
den = [1 14 0];
G = tf(num, den);
H = 1;
desired_overshoot = 5; % 5%
% Initialize variables
k = 1;
overshoot = 100; % Initialize overshoot to a high value
[y, t] = step(sys);
dc_gain = dcgain(sys);
[peak_amplitude, ~] = max(y);
overshoot = ((peak_amplitude - dc_gain) / dc_gain) * 100;
k = k + 1;
G = tf(k, den);
sys = feedback(G, H);
end
Exersice 3 part a
manually part
In this case, the plant transfer function G(s) is given as G(s) = 2(s+8)/(s(s+4)), and the
feedback transfer function H(s) is 1 (negative unity feedback). Substituting these
values into the feedback loop equation:
So, the closed-loop transfer function T(s) is T(s) = 2(s+8) / (s^2 + 6s + 8).
Matlab cod
% Define the transfer function G(s)
num = [2 16];
den = [1 4 0];
G = tf(num, den);
H = 1;
Exersice 3 part b
% Define the transfer function G(s)
num = [2 16];
den = [1 4 0];
G = tf(num, den);
H = 1;
t = 0:0.01:10;
u = ones(size(t));
plot(t, y);
title('Time Response for Unit Step Input');
xlabel('Time (s)');
ylabel('Output');
grid on;
exersice 3 part c
% Define the transfer function G(s)
num = [2 16];
den = [1 4 0];
G = tf(num, den);
H = 1;
t = 0:0.01:10;
u = ones(size(t));
exersice 3 part d
% Define the transfer function G(s)
num = [2 16];
den = [1 4 0];
G = tf(num, den);
u = ones(size(t));
title('Step Response');
xlabel('Time (s)');
ylabel('Output');
grid on;
steady_state_value = y(end);
exersice 3 part e
manually find:
Manually, you can observe the step response plot and identify the time it takes for the
response to settle within a certain percentage of the final value. Typically, settling time is
defined as the time it takes for the response to stay within a 2% or 5% tolerance band
around the steady-state value.
Code :
% Define the transfer function G(s)
num = [2 16];
den = [1 4 0];
G = tf(num, den);
H = 1;
u = ones(size(t));
plot(t, y);
title('Step Response');
xlabel('Time (s)');
ylabel('Output');
grid on;
settling_time_plot = step_info.SettlingTime;
exersice 4 part a
upper side 2 transfer function are cascade so using cascade command cascade it
for i = 1:length(K_values)
K = K_values(i);
r = roots(den - num);
disp(r);
disp('------------------');
end
exersice 4 part c
% Define the values of K
for i = 1:length(K_values)
K = K_values(i);
G = tf(num, den);
u = ones(size(t));
disp('------------------');
end
exersice 4 part d
% Define the desired percentage overshoot
% Initialize variables to store the best K value and the resulting peak time
best_K = 0;
best_peak_time = Inf;
% Iterate over each K value and find the resulting peak time
for i = 1:length(K_values)
K = K_values(i);
G = tf(num, den);
% Set the step input
t = 0:0.01:10;
u = ones(size(t));
peak_time = t(peak_index);
overshoot = max(y) - 1; % Assuming the initial value is 1
best_peak_time = peak_time;
end
end