EXP1:
AIM: To analyse the Time Domain Specification of Under damped second order system using MATLAB
Objective
To analyse the time-domain response of an underdamped second order system.
To extract key specifications such as rise time, settling time, peak time, and percent overshoot from the step
response using MATLAB.
Apparatus Required:
MATLAB Software
Theory:
Introduction
Time-domain analysis is crucial in control systems to understand the transient behavior of a system. For second
order systems, key performance metrics—such as rise time, peak time, settling time, and overshoot—are derived
from the system’s step response. An underdamped system (where the damping ratio, ζ, is between 0 and 1) typically
exhibits oscillatory behavior with a finite overshoot.
A standard second order system is described by the transfer function:
2 2 2
G(s) =¿Wn) /S +2*zeta*Wn*S+¿Wn)
where:
Wn is the natural frequency,
Zeta is the damping ratio.
For an underdamped system (0<Zeta<1):
Rise Time (tr): The time required for the response to go from 10% to 90% of its final value.
Peak Time (tp): The time at which the maximum overshoot occurs.
Settling Time (ts): The time required for the response to remain within a specified percentage (commonly 2% or
5%) of the final value.
Percent Overshoot (PO): The amount by which the peak level exceeds the steady-state value, expressed as a
percentage.
Consider an underdamped system with the following parameters:
Natural Frequency: Wn=5,Rad/sec
Damping Ratio: zeta={0.1 to 0.9} , let 0.4 (which qualifies as underdamped)
The transfer function becomes:
25
G(s) = 2
s + 4 s+25
Below is the MATLAB code used to plot the step response and analyze the time-domain specifications:
clc;
clear all;
close all;
wn=5;
zeta_values = [0.1 0.3 0.5 0.7 0.9]; % Different damping ratios
figure;
hold on;
for i = 1:length(zeta_values)
% Define system with new damping ratio
sys_temp = tf([wn^2], [1 2*zeta_values(i)*wn wn^2]);
% Get step response info
info = stepinfo(sys_temp);
% Plot step response
step(sys_temp);
% Display time domain specifications
fprintf('\nFor ? = %.1f:\n', zeta_values(i));
fprintf(' Rise Time (Tr) = %.4f sec\n', info.RiseTime);
fprintf(' Peak Time (Tp) = %.4f sec\n', info.PeakTime);
fprintf(' Settling Time (Ts) = %.4f sec\n', info.SettlingTime);
fprintf(' Peak Overshoot (Mp) = %.2f %%\n', info.Overshoot);
end
hold off;
grid on;
legend(‘zeta=0.1', ' zeta =0.3', ' zeta =0.5', ' zeta =0.7', ' zeta =0.9');
title('Step Response for Different Damping Ratios');
Explanation:
The transfer function is defined based on the chosen and .
The step command plots the response of the system to a unit step input.
The stepinfo function calculates key specifications (rise time, settling time, peak time, overshoot, etc.) and displays
them in the MATLAB Command Window.
Results & Observations
After running the MATLAB script:
Rise Time (tr): Indicates the time required for the response to go from 10% to 90% of its final value.
Peak Time (tp): Time taken to reach the maximum overshoot.
Settling Time (ts): The time taken for the response to remain within a certain tolerance band (usually 2% or 5% of
the final value).
Percent Overshoot (PO): Shows how much the peak value exceeds the final steady-state value, expressed as a
percentage.
The MATLAB output will display these values, allowing you to assess the transient performance of the system.
7. Conclusion
The time-domain analysis using MATLAB confirms that the underdamped second order system exhibits oscillatory
behavior with a finite overshoot. By obtaining the rise time, settling time, peak time, and percent overshoot from the
step response, one can evaluate if the system meets the desired performance criteria. Further tuning (for example,
via controller design) may be implemented if the specifications do not meet system requirements.
This report provides a comprehensive approach to analyzing the time-domain performance of an underdamped
system using MATLAB.
clc;
clear all;
close all;
Wn=5;
zeta=0.4;
num= [Wn^2];
den= [1 2*zeta*Wn Wn^2];
sys=tf(num,den);
step(sys);
grid on;
title('Step Response of underdamped Second-order System');
info=stepinfo(sys);
disp('Time Domain Specification:');
disp(['Rise Time (Tr)=',num2str(info.RiseTime),'sec']);
disp(['Peak Time (Tp)=',num2str(info.PeakTime),'sec']);
disp(['Settling Time (Ts)=',num2str(info.SettlingTime),'sec']);
disp(['Peak Overshoot (Mp)=',num2str(info.Overshoot),'%']);
OUTPUT:
Time Domain Specification:
Rise Time (Tr)=0.29304sec
Peak Time (Tp)=0.69078sec
Settling Time (Ts)=1.6819sec
Peak Overshoot (Mp)=25.3741%
GRAPH:
clc;
clear all;
close all;
Wn=5;
zeta_values = [0.1 0.3 0.5 0.7 0.9]; % Different damping ratios
figure;
hold on;
for i = 1:length(zeta_values)
sys_temp = tf([Wn^2], [1 2*zeta_values(i)*Wn Wn^2]);
step(sys_temp);
end
hold off;
grid on;
legend('zeta=0.1','zeta=0.3','zeta=0.5','zeta=0.7','zeta=0.9');
title('Step Response for Different Damping Ratios');
OUTPUT:
For Zeta = 0.1:
Rise Time (Tr) = 0.2254 sec
Peak Time (Tp) = 0.6283 sec
Settling Time (Ts) = 7.6746 sec
Peak Overshoot (Mp) = 72.92 %
For Zeta = 0.3:
Rise Time (Tr) = 0.2647 sec
Peak Time (Tp) = 0.6447 sec
Settling Time (Ts) = 2.2460 sec
Peak Overshoot (Mp) = 37.14 %
For Zeta = 0.5:
Rise Time (Tr) = 0.3278 sec
Peak Time (Tp) = 0.7184 sec
Settling Time (Ts) = 1.6152 sec
Peak Overshoot (Mp) = 16.29 %
For Zeta = 0.7:
Rise Time (Tr) = 0.4254 sec
Peak Time (Tp) = 0.8816 sec
Settling Time (Ts) = 1.1958 sec
Peak Overshoot (Mp) = 4.60 %
For Zeta = 0.9:
Rise Time (Tr) = 0.5767 sec
Peak Time (Tp) = 1.4430 sec
Settling Time (Ts) = 0.9400 sec
Peak Overshoot (Mp) = 0.15 %
EXP:2
To Analyse the stability of the System by Using Root Locus Using MATLAB
Objective:
To analyze the stability of a system using the Root Locus method in MATLAB.
To determine if the system is stable, unstable, or marginally stable based on pole locations.
Apparatus Required :
MATLAB Software
Theory:
Root locus analysis is a graphical technique used to study how the closed-loop poles of a control
system change as a system parameter (typically gain) varies. This report examines the stability of
a stable system using MATLAB by plotting its root locus and analysing pole positions.
The Root Locus method helps determine system stability by analysing pole movement. Stability
conditions:
1. Stable System: All poles have negative real parts (left-half plane).
2. Unstable System: At least one pole has a positive real part (right-half plane).
3. Marginally Stable: Poles on the imaginary axis without repetition.
The general transfer function is:
N (s )
G(s) =
D(s )
Where N(s) is the numerator polynomial.
D(s) is the denominator polynomial.
Consider a stable system with the transfer function:
1
G(s) =
S 2+ 4 s+5
The characteristic equation is:
S2 + 4s + 5 = 0
Solving for roots:
−4 ± √ (16−20) −4 ± j2
s= =
2 2
s = -2±j1
Since both poles have negative real parts, the system is stable.
clc;
clear;
close all;
% Define numerator and denominator of the transfer function
num = [1]; % Example: G(s) = 1 / (s^2 + 3s + 2)
den = [1 4 5];
% Create transfer function
sys = tf(num, den);
% Plot Root Locus
figure;
rlocus(sys);
title('Root Locus of the System');
% Check closed-loop poles for a specific gain (optional)
K = 10; % Example gain
sys_cl = feedback(K*sys, 1); % Closed-loop system
poles = pole(sys_cl); % Get closed-loop poles
disp('Closed-loop poles:');
disp(poles);
% Stability Analysis
if all(real(poles) < 0)
disp('The system is stable.');
else
disp('The system is unstable.');
end
OUTPUT:
Closed-loop poles:
-2.0000 + 3.3166i
-2.0000 - 3.3166i
The system is stable.
Results & Observations :
The root locus plot shows that the poles remain in the left-half plane for all gain values.
For , the closed-loop poles are , both having negative real parts.
Since all poles have negative real parts, the system is stable.
Conclusion:
The root locus analysis confirms that the given system is stable as all poles lie in the left-half
plane. The system remains stable for different gain values unless external disturbances or
controller modifications shift poles to the right.
Exp3:
To analyse the stability of the given linear system Using Bode Plot in MATLAB
Introduction
The Bode plot is a graphical method used to analyze the frequency response of a linear system. It
consists of two plots:
1. Magnitude plot (gain vs. frequency).
2. Phase plot (phase shift vs. frequency).
This report presents the stability analysis of a given system using the Bode plot in MATLAB.
Objective
To analyze the stability of a system using the Bode plot method in MATLAB.
To determine the gain margin (GM) and phase margin (PM) to check stability.
Apparatus Required :
MATLAB Software
Theory:
The transfer function of a system is given by:
N (s )
G(s) =
D(s )
Where N(s) is the numerator polynomial.
D(s) is the denominator polynomial.
Consider a stable system with the transfer function:
Stability Conditions from Bode Plot:
1. Gain Margin (GM):
The gain margin is the gain required to make the system unstable.
If GM > 1 (0 dB in logarithmic scale), the system is stable.
If GM < 1, the system is unstable.
2. Phase Margin (PM):
The phase margin is the additional phase required to bring the system to instability.
If PM > 0°, the system is stable.
If PM ≤ 0°, the system is unstable.
The crossover frequencies are:
Gain crossover frequency (): Frequency where the magnitude is 0 dB.
Phase crossover frequency (): Frequency where the phase is -180°.
10
Consider a system with the transfer function: G(s) =
S 2+3 s+2
The characteristic equation is= S2+3S+2
Solving for roots:
−3 ± √(9−8) −3 ±1
s= =
2 2
s = -1, -2
Since both poles have negative real parts, the system is stable.
The following MATLAB script performs Bode plot analysis:
clc;
clear;
close all;
% Define numerator and denominator of the transfer function
num = [10]; % Example: G(s) = 10 / (s^2 + 3s + 2)
den = [1 3 2];
% Create transfer function
sys = tf(num, den);
% Plot Bode Plot
figure;
bode(sys);
title('Bode Plot of the System');
% Find Gain Margin and Phase Margin
[GM, PM, Wcg, Wcp] = margin(sys);
% Display Stability Margins
disp('Gain Margin (GM) in dB:');
disp(20*log10(GM));
disp('Phase Margin (PM) in degrees:');
disp(PM);
disp('Gain Crossover Frequency (Wcg):');
disp(Wcg);
disp('Phase Crossover Frequency (Wcp):');
disp(Wcp);
% Stability Analysis
if PM > 0
disp('The system is stable.');
else
disp('The system is unstable.');
end
Results & Observations:
Gain Margin (GM) in dB: Inf
Phase Margin (PM) in degrees: 55.8621
Gain Crossover Frequency (Wcg):Inf
Phase Crossover Frequency (Wcp):2.7590
The system is stable.
The Bode magnitude plot shows how the gain changes with frequency.
The Bode phase plot shows how the phase shift varies with frequency.
Gain margin (GM) and phase margin (PM) indicate stability:
If PM > 0°, the system is stable.
If PM ≤ 0°, the system is unstable.
7. Conclusion
The Bode plot confirms that the given system is stable, as the phase margin (PM) is positive. The
gain margin (GM) is greater than 0 dB, further indicating stability. The system remains stable
unless external modifications or parameter variations shift stability margins.