LAB MANUAL SIMULATION FINAL

Download as pdf or txt
Download as pdf or txt
You are on page 1of 49

LABORATORY MANUAL FOR

SIMULATION LABORATORY
B. Tech.

DEPARTMENT OF INSTRUMENTATION & CONTROL


ENGINEERING

DR B R AMBEDKAR NATIONAL INSTITUTE OF


TECHNOLOGY
JALANDHAR
PUNJAB
ICPC-322 Simulation Laboratory [0 0 2 1]

At least 8 experiments are to be performed out of the following list:

1. To convert temperature from 0Celcius to 0Fahrenheit and Kelvin scale.


2. To obtain Lissajous pattern for two different sinusoidal signals.
3. To obtain correlation between two discrete and two continuous signals.
4. To convert a continuous signal to a discrete signal and vice versa.
5. To obtain convolution between two discrete signals and two continuous signals.
6. To study maximum power transfer theorem.
7. To study a moving average filter.
8. To import a text file and perform read, write and shift register operations on it.
9. To study first order system response to step and impulse input.
10. To obtain the response of PID controller for first and second order systems.
11. To study R-L-C series circuit response to both impulse and step input.
12. To study R-L-C parallel circuit response to both impulse and step input.
13. To study R-L-C series and parallel circuit response to sinusoidal input.
14. To study a notch filter and remove 50 Hz noise from given signal.
15. To study mass spring damper system response to both impulse and step
input.

The list of experiments given above is only suggestive. The Instructor may add
new experiments as per the requirement of the course.

Course Outcome:
After completion of this course, the students would be able to:
 Understand modeling of complex systems with hands on experience for a
given process
 Understand signal transmission through linear systems, convolution and
correlation of signals and sampling
EXPERIMENT: - 01
Objective: - To study the generating Lissajous pattern for different frequency
input.

Software used: - software, Simulink sim scape.


THEORY: -
The definition of a Lissajous figure can be defined as one of an infinite number of curves formed
by combining two simple oscillations that are perpendicular to each other. This is usually
viewed by an oscilloscope and is used to study the frequency, amplitude, and phase
relationships of harmonic variables
The Lissajous figures oscilloscope allows you to plot one sine wave along the x-axis against
another sine wave along the y-axis. The result is the number of measurements. The Lissajous
figure shows the phase difference between the two signals and the relationship between their
frequencies.
Lissajous is the pattern that appears on the screen when a sinusoidal signal is applied to the
horizontal and vertical caps of the CRO. These patterns depend on the amplitude, frequency,
and phase difference of the sinusoidal signal applied to the horizontal and vertical baffles of
the CRO.

Measurement using Lissajous figures: -


Let, fH and fV are the frequencies of sinusoidal signals, which are applied to the
horizontal & vertical deflection plates of CRO respectively. The relationship
between fH and fV can be mathematically represented as below.

Where, fV/fH=nH/nV

nH is the number of horizontal tangencies

nV is the number of vertical tangencies

We can find the values of nH and nV from Lissajous figure. So, by substituting the
values of nH, nV and fH in Equation 1, we will get the value of fV, i.e.
the frequency of sinusoidal signal that is applied to the vertical deflection
plates of CRO.
Measurement of Phase Difference: -
A Lissajous figure is displayed on the screen when sinusoidal signals are applied
to both horizontal & vertical deflection plates of CRO. Hence, apply the sinusoidal
signals, which have same amplitude and frequency to both horizontal and vertical
deflection plates of CRO.

For few Lissajous figures based on their shape, we can directly tell the phase
difference between the two sinusoidal signals.

 If the Lissajous figure is a straight line with an inclination of 45∘ with positive x-axis,
then the phase difference between the two sinusoidal signals will be 0∘0∘. That means,
there is no phase difference between those two sinusoidal signals.

 If the Lissajous figure is a straight line with an inclination of 135∘ with positive x-axis,
then the phase difference between the two sinusoidal signals will be 180∘. That means,
those two sinusoidal signals are out of phase.

 If the Lissajous figure is in circular shape, then the phase difference between the two
sinusoidal signals will be 90∘ or 270∘.

Flowchart: -
Define the frequency values in "w1"
and "w2".

Define the phase values in "p1"


and "p2".

We have to plot the waveforms which


we take as "x" and "y" as a sine wave.

Plot the response in 'x' and 'y' axis


using plot function.
MATLAB CODE: -
w1=50;
w2=50;
p1=0;
p2=0;
t=0:0.01:2*pi;
x=sin(w1*t+p1);
y=sin(w2*t+p2);
subplot (2,2,1);
plot (x, y);

w1=50;
w2=100;
p1=0;
p2=0;
t=0:0.01:2*pi;
x=sin(w1*t+p1);
y=sin(w2*t+p2);
subplot(2,2,2);
plot(x,y);

w1=50;
w2=50;
p1=pi/4;
p2=3*pi/4;
t=0:0.01:2*pi;
x=sin(w1*t+p1);
y=sin(w2*t+p2);
subplot (2,2,3);
plot (x, y);

Simulation model: -

Result:- We have successfully plot and verify Lissajous pattern .


MATLAB OUTPUT: -
EXPERIMENT - 02

Objective: - To study unit step response and sinusoidal response of a series


RLC circuit taking voltage across capacitor as output voltage.

Software used:-MATLAB software, Simulink.

THEORY: - A series resistive-inductive-capacitive (RLC) circuit consists of a


resistor, inductor, and capacitor connected in series. The behavior of this circuit
can be analyzed using techniques from circuit theory and differential equations.
When a step voltage is applied to the circuit, the inductor initially resists
the change in current, causing a transient response. The capacitor also affects the
behavior of the circuit by storing and releasing energy.
The overall response of the circuit depends on the values of resistance
(R), inductance (L), and capacitance (C), as well as the applied voltage. Depending
on the relative values of these components, the circuit can exhibit different types
of behavior, such as overdamped, critically damped, or underdamped responses.
Analyzing the transient response of an RLC circuit involves solving the differential
equation that describes the circuit's behavior, which typically results in a second-
order linear differential equation. The solution to this equation yields information
about the circuit's time-domain behavior, including the transient and steady-state
responses, resonant frequency, and damping factor.

Circuit Diagram :-A series RLC circuit with input applied at the resistor and
ground and output taken across the capacitor is drawn as:
Replacing C by 1/sC and L by sL the equivalent circuit can be drawn as:

Calculation :- Applying voltage division rule , the voltage across the capacitor is :

Flowchart:
Define 's' as variable of transfer
function using 'tf' function.

Define the value of resistor(R),


capacitor (C)and inductor(L).

Write down the transfer function


in s domain

Plot the response by 'sine'


and 'step' function
MATLAB CODE:-
s=tf(‘s’);
L = 1;
R = 2.5;
C = 0.005;
RLC =1/(C*L*s*s+R*C*s+1);
Subplot(2,1,1);
step(RLC);
Subplot(2,1,2)
step(RLC*s/(s*s+1);

Simulink Diagram:- For step response of RLC circuit the simulink diagram is as
shown

For Sinusoidal response of RLC circuit the simulink diagram is as shown


MATLAB Output :-Step response of RLC circuit

 Sinusoidal response of RLC circuit


Simulink Output :- Step response of RLC circuit on oscilloscope is

 Sinusoidal response of RLC circuit


Result:- We have successfully obtain the desired response of the system for step
as well as Sinusoidal input.
Experiment-3
Aim:- To study the unit step & ramp response of 1st order system.
 1st order higher pass filter (passive)
 1st order low pass filter
 R-L circuit (1st order)
Software Used: - MATLAB
Objective: - To explore the behavior of first-order systems under different input signals (unit
step & ramp) and analyze their response.
Theory:-
1. First-Order High Pass Filter:
A first-order high-pass filter is a simple passive filter circuit that allows high-frequency signals
to pass through while attenuating low-frequency signals. The transfer function of a first-order
high-pass filter can be represented as:

sR
H ( s) 
sR  1

Where R is the resistance value of the resistor in the circuit.

2. First-Order Low Pass Filter:

A first-order low-pass filter is another simple passive filter circuit that allows low-frequency
signals to pass through while attenuating high-frequency signals. The transfer function of a
first-order low-pass filter can be represented as:

1
H ( s) 
sR  1

Where R is the resistance value of the resistor in the circuit.

3. R-L Circuit:

An R-L circuit consists of a resistor (R) and an inductor (L) connected in series. The response of
this circuit is governed by the time constant τ, which is the product of the resistance and
L
inductance (τ= ). The transfer function of an R-L circuit is:
R

1
H ( s) 
sL  R
Circuit Diagram :-
1. Passive High pass filter

sR
H ( s) 
sR  1

2. Low pass filter

1
H ( s) 
sR  1

3. RL Circuit

1
H ( s) 
sL  R
Flow-Chart (For MATLAB code):-

MATLAB Code :-
R=2; C=3 ;L=1
S=tf('s');
Highpass= (R*C*S)/(1+R*C*S);
Lowpass = 1/(1+R*C*S);
RLckt=R/(R+S*L);
subplot(3,2,1);
step(Highpass);
subplot(3,2,2);
step(Highpass/S);
subplot(3,2,3);
step(Lowpass);
subplot(3,2,4);
step(Lowpass/S);
subplot(3,2,5);
step(RLckt);
subplot(3,2,6);
step(RLckt/S);
Simulink Diagram :-

Results :-
 MATLAB Output :-
 Scope Output for High pass(step and ramp input):-

 Scope Output for Low pass(step and ramp input):-

 Scope Output for RL Circuit(step and ramp input):-


EXPERIMENT - 04
Objective: - To study the modelling and controller tunning of Inverted
Pendulum.

Software Used:- MATLAB software, Simulink simscape .


Theory: - Following figure shows a free body schematic diagram of
inverted pendulum cart system. The nomenclature x and θ indicate cart
position and tilt angle variation in a vertically upward respectively. The
pendulum rod is assumed massless and the hinge is considered as
frictionless in the calculation. All the forces, that acted on the cart system
are depicted in the diagram.

Summing the forces in the free-body diagram of the cart in the horizontal direction,
you get the following equation of motion.
(1)

Summing the forces in the free-body diagram of the pendulum in the horizontal
direction, you get the following expression for the reaction force N.
(2)
If you substitute this equation into the first equation, you get one of the two
governing equations for this system.
(3)

To get the second equation of motion for this system, sum the forces perpendicular
to the pendulum. Solving the system along this axis greatly simplifies the
mathematics. You should get the following equation.
(4)

To get rid of the P and N terms in the equation above, sum the moments about the
centroid of the pendulum to get the following equation.
(5)

Combining these last two expressions, you get the second governing equation.
(6)
Since the analysis and control design techniques we will be employing in this
example apply only to linear systems, this set of equations needs to be linearized.
Specifically, we will linearize the equations about the vertically upward equillibrium
position, 𝜃 = 𝜋 and will assume that the system stays within a small neighborhood of
this equillbrium. This assumption should be reasonably valid since under control we
desire that the pendulum not deviate more than 20 degrees from the vertically upward
position. Let 𝜙 represent the deviation of the pedulum's position from equilibrium,
that is, 𝜃 = 𝜋+ 𝜙 . Again presuming a small deviation (𝜙 ) from equilibrium, we can
use the following small angle approximations of the nonlinear functions in our
system equations:

After substiting the above approximations into our nonlinear governing equations,
we arrive at the two linearized equations of motion. Note has been substituted for
the input F.
1. Transfer Function
To obtain the transfer functions of the linearized system equations, we must first take
the Laplace transform of the system equations assuming zero initial conditions. The
resulting Laplace transforms are shown below.

Recall that a transfer function represents the relationship between a single input and
a single output at a time. To find our first transfer function for the output 𝜙 (s) and
an input of we need to eliminate X(S) from the above equations. Solve the first
equation for X(s).

(
Then substitute the above into the second equation.

Rearranging, the transfer function is then the following

where,

From the transfer function above it can be seen that there is both a pole and a zero
at the origin. These can be canceled and the transfer function becomes the
following.

Second, the transfer function with the cart position X(s) as the output can be
derived in a similar manner to arrive at the following.
2. State-Space
The linearized equations of motion from above can also be represented in state-
space form if they are rearranged into a series of first order differential equations.
Since the equations are linear, they can then be put into the standard matrix form
shown below.

The C matrix has 2 rows because both the cart's position and the pendulum's position
are part of the output. Specifically, the cart's position is the first element of the output
Y and the pendulum's deviation from its equilibrium position is the second element
of Y.

Flowchart:-
Define 's' as variable of transfer
function using 'tf' function

Define the values of M, m, b, I, g, and l.

Write down the transfer function


in s domain

Use pidtune function for optimal control of


inverted pendulum.

Plot the response using 'step' function


MATLAB CODE: -
M = 0.5;
m = 0.2;
b = 0.1;
I = 0.006;
g = 9.8;
l = 0.3;
q = (M+m)*(I+m*l^2)-(m*l)^2;
s = tf('s');
P_pend = (m*l*s/q)/(s^3 + (b*(I + m*l^2))*s^2/q - ((M + m)*m*g*l)*s/q -
b*m*g*l/q);

b = pidtune(P_pend,'PID') ;
c = feedback(P_pend*b,1);
step(c)

Simulink Model :-
MATLAB Output: -
Simulink Output:-
Result: - We have successfully modelled and controlled the
inverted pendulum.
EXPERIMENT 05

Objective:- To study the mass spring damper system response to to


both impulse and step input.

Software USED:-MATLAB software, Simulink simscape .


THEORY :- The mass-spring-damper model consists of discrete mass
nodes distributed throughout an object and interconnected via a network
of springs and dampers. This model is well-suited for modelling object with
complex material properties such as nonlinearity and viscoelasticity.
Packages such as MATLAB may be used to run simulations of such
models. As well as engineering simulation, these systems have
applications in computer graphics and computer animation.
Simscape Component
SOLVER :-A solver applies a numerical method to solve the set of ordinary
differential equations that represent the model. Through this computation, it
determines the time of the next simulation step. In the process of solving this initial
value problem, the solver also satisfies the accuracy requirements that you specify.
PS-Convertor:- The Simulink-PS Converter block converts the input
Simulink® signal into a physical signal. Use this block to connect Simulink sources
or other Simulink blocks to the inputs of a Simscape™ physical network.
Ideal Force Source :- The Ideal Force Source block represents an ideal source of
mechanical energy that generates force proportional to the input physical signal.

Circuit Diagram :-
Transfer function :- 1/(Ms^2+Bs+K);

Flowchart:

Define 's' as variable of transfer


function using 'tf' function.

Define the value of mass(M),


damper (B)and spring (K).

Write down the transfer function


in s domain

Plot the response by 'impulse'


and 'step' function
-
MATLAB CODE:-
s=tf(‘s’);
M=1;
B=5;
K=10;
Sys=1/(M*s*s+B*s+K);
Subplot(2,1,1);
impulse(Sys);
Subplot(2,1,2)
step(Sys);
Simscape Modle:-

Result:- We have successfully obtain the response of the system


For step as well as impulse input.
MATLAB OUTPUT

Scope Output fot step input


EXPERIMENT NO - 6

DESIGN OF LAG, LEAD AND LAG-LEAD COMPENSATOR

AIM: To design lag, lead compensator, lag-lead compensator

THEORY:

The primary objective of this experiment is to design the compensation of single –input-single-output
linear time invariant control system.
Compensation is the modification of the system dynamics to satisfy the given specification. The
compensation is done by adding some suitable device in which is called as compensator. Compensator is realized
by such a way as to meet the performance specifications.
If sinusoidal input is applied to a network and if the steady state output has a phase lead, then the network
is called a lead network, and if the output has a phase lag then the network is called as a phase lag network.
Compensators are realized in our experiments using op-amps , electrical RC network as shown in figure.

where

This network is a lead network if R1 C1> R2 C2 or <1.


Or this is a lag network if >1 or R1 C1< R2 C2
PROCEDURE

1) Consider any uncompensated system


2) Design the lead and lag compensator from the given circuit using the above equations.
3) Connect this design compensator to uncompensated system in series compensation.
4) Then find the closed loop transfer function equation for this compensated system
5) Plot the response for both uncompensated and compensated system

For Lead Compensator

The closed loop transfer function equation for the compensated system becomes

Hence
numc= [0 0 18.7 54.23]
denc= [1 7.4 29.5 54.23]

for the uncompensated system the closed loop transfer function is

Hence
numc= [0 0 4]
denc= [1 2 4]
PROGRAM:
% Unit Step Response of Compensated and Uncompensated systems

numc=[0 0 18.7 54.23];


denc=[1 7.4 29.5 54.23];
num=[0 0 4];
den=[1 2 4];
t=0:0.05:5;
[c1,x1,t]=step(numc,denc,t);
[c2,x2,t]=step(num,den,t);
plot(t,c1,t,c1,'o',t,c2,t,c2,'x');
grid;
title('Unit step response of Compensated and Uncompensated Systems');
xlabel('t sec')
ylabel('Outputs c1 and c2');
text(0.6,1.32,'Compensated system');
text(1.3,0.68,'Uncompensated system');

Unit step response of Compensated and Uncompensated Systems

1.4
Comp ensated syste m

1.2

1
Outputs c1 and c2

0.8

Uncompensated system
0.6

0.4

0.2

0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
t sec
For Lag Compensator
The closed loop transfer function equation for the compensated system becomes

for the uncompensated system the closed loop transfer function is

PROGRAM:
% Unit Step Response of Compensated and Uncompensated systems

numc=[0 0 0 1.0235 0.0512];


denc=[1 3.005 2.015 1.0335 0.0512];
num=[0 0 0 1.06];
den=[1 3 2 1.06];
t=0:0.1:40;
[c1,x1,t]=step(numc,denc,t);
[c2,x2,t]=step(num,den,t);
plot(t,c1,t,c1,'o',t,c2,t,c2,'x');
grid;
text(13,1.12,'Compensated system');
text(13.6,0.88,'Uncompensated system');
title('Unit step response of Compensated and Uncompensated Systems');
xlabel('t sec')
ylabel('Outputs c1 and c2');
Unit step response of Compensated and Uncompensated Systems
1.4

1.2
Compensated system

1
Outputs c1 and c2

Uncompensated system
0.8

0.6

0.4

0.2

0
0 5 10 15 20 25 30 35 40
t sec

RESULTS & DISCUSSIONS: Compensators are added to existing systems to


improve their performance.
 Such compensators based on the change required in performance of the
system have been designed and improvement in performance analyzed using
MATLAB.
 Change in the performance of the system with compensator is observed.
EXPERIMENT NO – 7
ROOT LOCUS, BODE AND NYQUIST PLOT

ROOT LOCUS:

AIM: To obtain the root locus of the system whose transfer function is defined by
(S+5)
G(S)=
S^2+7S+25

PROCEDURE:

1. Input the numerator and denominator co-efficient.


2. Formulate the transfer function using the numerator and denominators co-efficient with the help
of function T = tf (num, den)
3. Plot the root locus of the above transfer function using rlocus(t).

PROGRAM:
%Program to find the root locus of transfer function%
s+5)
%
% s^2+7s+25

clc;
clear all;
close all;
% initialzations
num=input('enter the numerator coefficients ---->');
den=input('enter the denominator coefficients ---->');
%Transfer function
sys=tf(num,den);
rlocus(sys);

PROGRAM RESULT:
enter the numerator coefficients---->[1 5]
enter the denominator coefficients---->[1 7 25]
Root Locus
5

1
Imaginary Axis

-1

-2

-3

-4

-5
-18 -16 -14 -12 -10 -8 -6 -4 -2 0 2
Real Axis

BODE PLOT:

THEORY: The gain margin is defined as the change in open loop gain required to make the system
unstable. Systems with greater gain margins can withstand greater changes in system parameters before
becoming unstable in closed loop. Keep in mind that unity gain in magnitude is equal to a gain of zero
in dB.

The phase margin is defined as the change in open loop phase shift required to make a closed loop
system unstable.

The phase margin is the difference in phase between the phase curve and -180 deg at the point
corresponding to the frequency that gives us a gain of 0dB (the gain cross over frequency, Wgc).

Likewise, the gain margin is the difference between the magnitude curve and 0dB at the point
corresponding to the frequency that gives us a phase of -180 deg (the phase cross over frequency, Wpc).

AIM: To obtain the bode plot and to calculate the phase margin, gain margin, phase cross over and gain
cross over frequency for the systems whose open loop transfer function is given as follows.
25(S+1) (S+7)
G(s) =
S(S+2) (S+4) (S+8)
PROCEDURE:

1. Input the zeroes, poles and gain of the given system.


2. Formulate the transfer function from zeroes, poles and gain of the system.
3. Plot the bode plot using function bode (t).
4. Estimate PM,GM, WPC , and WGC. Using function margin.

PROGRAM:
%Program to find Bode Plot
% 25(s+1)(s+7)
%
% s(s+2)(s+4)(s+8)
clc;
clear all;
close all;
% initialzations
k=input('enter the gain---->');
z=input('enter the zeros ---->');
p=input('enter the ploes ---->');
t=zpk(z,p,k);
bode(t);
[Gm,Pm,Wcg,Wcp]=margin(t);
disp(Gm);
disp(Pm);
disp(Wgc);
disp(Wpc);

PROGRAM RESULT:
enter the gain ---->25
enter the zeros---->[-1 -7]
enter the ploes---->[0 -2 -4 -8]

Gm= Inf
Pm= 63.1105
Wgc= Inf
Wpc= 3.7440

Bode Diagram
50
Magnitude (dB)

-50

-100
-45
Phase (deg)

-90

-135

-180
-1 0 1 2 3
10 10 10 10 10
Frequency (rad/sec)
NYQUIST PLOT:

AIM:
To obtain the Nyquist plot and to calculate the phase margin, gain margin, phase cross over and
gain cross over frequency for the systems whose open loop transfer function is given as follows.

50(S+1)
G(S) =
S(S+3) (S+5)

PROCEDURE:

1. Input the zeroes, poles and gain of the given system.


2. Formulate the transfer function from zeroes, poles and gain of the system.
3. Plot the nyquist plot using function nyquist(t).
4. Estimate PM,GM, WPC , and WGC. Using function margin.

PROGRAM:
%Program to find the Nyquist Plot

% 50(s+1)
%
% s(s+3)(s+5)

clc;
clear all;
close all;
% initialzations
num=input('enter the numerator coefficients ---->');
den=input('enter the denominator coefficients ---->');
sys=tf(num,den);
nyquist(sys);
title('system1');
[Gm,Pm,Wcg,Wcp]=margin(sys);
disp(Gm);
disp(Pm);
disp(Wgc);
disp(Wpc);

PROGRAM RESULT:
enter the numerator coefficients---->[50 50]
enter the denominator coefficients---->[1 8 15]

Gm= Inf
Pm= 98.0516
Wgc=Inf
Wpc=49.6681
system1
4

1
Imaginary Axis

-1

-2

-3

-4
-1 0 1 2 3 4 5 6 7
Real Axis

RESULTS & DISCUSSIONS: Root Locus, Bode plot and Nyquist plot determined using the built-in
functions of MATLAB.
 They are a powerful tool to design systems to required performance.
 In order to determine the stability of the system using the root locus technique we find the range
of values of k for which the complete performance of the system will be satisfactory and the
operation is stable.
 Bode plots provides relative stability in terms of gain margin and phase margin
EXPERIMENT NO – 8
TRANSFER FUNCTION ANALYSIS OF I) TIME RESPONSE FOR
STEP INPUT II) FREQUENCY RESPONSE FOR SINUSOIDAL
INPUT.

AIM:To find the I) Time response for step input II) Frequency response for sinusoidal input.

I .TIME RESPONSE FOR STEP INPUT:

SOFTWARES USED: MATLAB

THEORY: The general expression of transfer function of a second order control system is given as

Here, ζ and ωn are damping ratio and natural frequency of the system respectively
There are number of common terms in transient response characteristics and which are
1. Delay time (td) is the time required to reach at 50% of its final value by a time response signal

during its first cycle of oscillation.

2. Rise time (tr) is the time required to reach at final value by a under damped time response signal
during its first cycle of oscillation. If the signal is over damped, then rise time is counted as the

time required by the response to rise from 10% to 90% of its final value.

3. Peak time (tp) is simply the time required by response to reach its first peak i.e. the peak of first

cycle of oscillation, or first overshoot.

4. Maximum overshoot (Mp) is straight way difference between the magnitude of the highest peak
of time response and magnitude of its steady state. Maximum overshoot is expressed in term of
percentage of steady-state value of the response. As the first peak of response is normally
maximum in magnitude, maximum overshoot is simply normalized difference between first peak
and steady-state value of a response.
5. Settling time (ts) is the time required for a response to become steady. It is defined as the time
required by the response to reach and steady within specified range of 2 % to 5 % of its final

value.

6. Steady-state error (e ss ) is the difference between actual output and desired output at the infinite
range of time.

PROBLEM STATEMENT: For the closed loop system defined by

C(S) 100
=
R(S) S2 +12S + 100
Plot the unit step response curve and find time domain specifications

PROGRAM:
clc;
clear all;
close all;
num=input('enter the numerator coefficients ---->');
den=input('enter the denominator coefficients ---->');
system=tf(num,den);
system
step(system)
grid on;
wn=sqrt(den(1,3));
zeta= den(1,2)/(2*wn);
wd=wn*sqrt(1-zeta^2);
disp('Delay time in seconds is')
td=(1+0.7*zeta)/wd
disp('Rise time in seconds is')
theta=atan(sqrt(1-zeta^2)/zeta);
tr=(pi-theta)/wd
disp('Peak time in seconds');
tp=pi/wd
disp('Peak overshoot is');
mp=exp(-zeta*pi/sqrt(1-zeta^2))*100
disp('settling time in seconds is');
ts=4/(zeta*wn)

PROGRAM RESULT:
enter the numerator coefficients ---->100
enter the denominator coefficients---->[1 12 100]

Transfer function:
100

s^2 + 12 s + 100

Delay time in seconds is

td =

0.1775

Rise time in seconds is

tr =

0.2768

Peak time in seconds

tp =

0.3927

Peak overshoot is

mp =

9.4780

settling time in seconds is

ts =

0.6667
Step Response
1.4

1.2

0.8
Amplitude

0.6

0.4

0.2

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8
Time (sec)

II. FREQUENCY RESPONSE FOR SINUSOIDAL INPUT

By the term frequency response, we mean the steady-state response of a system to a sinusoidal input.
Industrial control systems are often designed using frequency response methods. Many techniques are
available in the frequency response methods for the analysis and design of control systems.
Consider a system with sinusoidal input r(t)  Asin t . The steady-state output may be written
as, c(t)  B sin(t   ) . The magnitude and the phase relationship between the sinusoidal input and the
steady-state output of a system is called frequency response. The frequency response test is performed
by keeping the amplitude A fixed and determining B and  for a suitable range of frequencies.
Whenever it is not possible to obtain the transfer function of a system through analytical techniques,
frequency response test can be used to compute its transfer function.
The design and adjustment of open-loop transfer function of a system for specified closed-loop
performance is carried out more easily in frequency domain. Further, the effects of noise and parameter
variations are relatively easy to visualize and assess through frequency response. The Nyquist criteria is
used to extract information about the stability and the relative stability of a system in frequency domain.

The transfer function of a standard second-order system can be written as,


C(s) n2
T (s)   .
R(s) s2  2ns  2n
n2 1
Substituting s by j we obtain, T ( j)   .
( j)  2n ( j)  n (1 u )  j2 u
2 2 2

Where, u   / n is the normalized signal frequency. From the above equation we get,
1
T ( j)  M 
(1 u2 )2  (2 u)2 .
T ( j)     tan1[2 u /(1 u2 )]
The steady-state output of the system for a sinusoidal input of unit magnitude and variable frequency 
is given by, 1  2 u 
c(t)  sin t  tan1
1 u2 
.
(1 u2 )2  (2 u)2  

It is seen from the above equation that when,
u  0, M 1 and 0
1
u  1, M  and    / 2
2
u  , M 0 and   
The magnitude and phase angle characteristics for normalized frequency u for certain values of  are
shown in figure in the next page.

The frequency where M has a peak value is called resonant frequency. At this point the slope of the
1 4(1 ur )ur  8 ur 
2 2
dM
magnitude curve is zero. Setting  0 we get,   0.
du u ur 2 (1 ur2 )2  (2 u r)2  3/ 2
 
Solving, ur  1 2 2 or, resonant frequencyr  n 1 2 2 . ………… …… (01)
1
The resonant peak is given by resonant peak, M r  . ……………… (02)
2 1  2
1
 For,   ( 0.707) , the resonant frequency does not exist and M decreases monotonically
2
with increasing u.
1
 For 0    , the resonant frequency is always less than n and the resonant peak has a
2
value greater than 1.
From equation (01) and (02) it is seen that The resonant peak Mr of frequency response is indicative of
damping factor and the resonant frequency r is indicative of natural frequency for a given  and
hence indicative of settling time.
For   r , M decreases monotonically. The frequency at which
1
M has a value of is called the cut-off frequency c . The
2
range of frequencies over which M is equal to or greater than
1 is defined as bandwidth,  .
b
2
The bandwidth of a second-order system is given by,
   1 2 2  2  4 2  4 4  ………….(03)
1/ 2

b n
 

Figure below shows the plot of resonant peak of frequency response and the peak overshoot of step
response as a function of  .

It is seen that the two performance indices are correlated as


both are the functions of the system damping factor  only.
1
For   ( 0.707) the resonant peak does not exist and
2
the correlation breaks down. For this range of  , M p is hardly
perceptible.

From equation (03) it is seen that the bandwidth is indicative of


natural frequency and hence indicative of settling time, i.e., the
speed of response for a given  .

PROGRAM:

%Frequency Response of second order system


clc;
clear all;
close all;
num=input('enter the numerator coefficients ---->');
den=input('enter the denominator coefficients ---->');
%Transfer function
sys=tf(num,den);
wn=sqrt(den(1,3));
zeta= den(1,2)/(2*wn);
w=linspace(0,2);
u=w/wn;
len=length(u);
for k=1:len
m(k)=1/(sqrt((1-u(k)^2)+(2*zeta*u(k))^2));
phi(k)=-atan((2*zeta*u(k))/(1-u(k)^2))*180/pi;
end
subplot(1,2,1)
plot(w,m)
xlabel('normalized frequency')
ylabel('magnitude')
subplot(1,2,2)
plot(w,phi)
xlabel('normalized frequency')
ylabel('phase')
disp('resonant peak is');
mr=1/(2*zeta*sqrt(1-zeta^2))
disp('resonant frequency in rad/sec is');
wr=wn*sqrt(1-2*zeta^2)
disp('bandwidth in rad/sec is');
wb=wn*sqrt(1-2*zeta^2+sqrt(2-4*zeta^2+4*zeta^4))
disp('phase margin in degrees is')
pm=180+(atan(2*zeta/sqrt(-2*zeta^2+sqrt(4*zeta^4 +1))))*180/pi

PROGRAM RESULT:
enter the numerator coefficients ---->100
enter the denominator coefficients---->[1 12 100]
resonant peak is

mr =

1.0417
resonant frequency in rad/sec is

wr =

5.2915

bandwidth in rad/sec is

wb =

11.4824

phase margin in degrees is

pm =

239.1873
1.001 0

0.999

0.998
-5
0.997
magnitude

phase
0.996

0.995
-10
0.994

0.993

0.992

0.991 -15
0 0.5 1 1.5 2 0 0.5 1 1.5 2
normalized frequency normalized frequency

RESULTS & DISCUSSIONS: Defining transfer functions and finding response using these transfer
functions has been simulated using MATLAB.
Responses can be studied with addition of controllers and their effect on performance.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy